[Openmcl-devel] Compiler warnings
Tobias C. Rittweiler
tcr at freebits.de
Tue Oct 20 19:16:50 UTC 2009
Daniel Weinreb <dlw at itasoftware.com> writes:
> Ron Garret wrote:
> > Yes, but it is defensible behavior in light of what the spec says,
> > namely (section 220.127.116.11.1):
> > "If a form is a symbol, then it is either a symbol macro or a variable."
> > and
> > "If a form is a symbol that is not a symbol macro, then it is the name
> > of a variable, .... There are three kinds of variables: lexical
> > variables, dynamic variables, and constant variables."
> > Since a "naked" symbol that is not bound and has not been DEF...ed is
> > clearly not a lexical variable nor a constant variable, one could
> > reasonably conclude that it must be a dynamic variable.
> I agree with all of this. The only thing that (setq a 4)
> at top level can possibly mean, if it's not considered
> to be illegal, is to treat the symbol a as a dynamic variable.
> But for it to automatically create a declaration, which will
> cause future uses of that symbol to be treated as
> dynamic variables even when inside a lexical scope
> that defines a variable named by that symbol, is
> a different thing, and isn't necessarily implied by
> the spec. So I don't agree that the CMUCL behavior
> is the only reasonable thing to do.
Uhm, if you agree with Ron's argumentation, but do not want the
automatic special proclamation, this would mean that
* (setf x 42)
must signal an unbound variable error because it'd try to look up a
lexical variable X which is not there.
* (locally (declare (special x)) x)
More information about the Openmcl-devel