[Openmcl-devel] Compiler warnings

Jeremy Jones jaj at clozure.com
Wed Oct 21 02:47:17 UTC 2009


Ron Garret wrote:
> "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."

I'm not a language lawyer, but my interpretation is that if x is
unbound, and you do a toplevel (setf x 1), you're creating a dynamic
variable but it's not special.  So there are two subtypes of dynamic
variables, free variables and special variables.  I claim that CCL is
conforming to the standard because it only has three toplevel types of
variables.  A free variable is dynamic because its value is looked up
in the value cell of a symbol at run time.  The values of lexical
variables are stored in places only the compiler knows about.  A free
variable is not special because it hasn't been declared special, so it
is not dynamically bound when it is used in code.  I'm distinguishing
between dynamic binding and dynamic variables (I admit that might be
confusing).  Special variables are dynamically bound, but if you
create a binding of a free variable with let or lambda, it is not
dynamically bound.

A possible intermediate behavior between cmucl and ccl would be warn
and declare that a free variable is declared special like cmucl, but
keep track of the fact that it was automatically declared special.
Then signal a warning when code is compiled that binds an
automatically declared special variable.



More information about the Openmcl-devel mailing list