[Openmcl-devel] Compiler warnings
dlw at itasoftware.com
Wed Oct 21 15:01:30 EDT 2009
Ron Garret wrote:
>> Whether a symbol has been declared special is one of the
>> inputs to the decision that the evaluator makes as to
>> whether to treat a symbol (when seen in context of
>> being a varible) as dynamic versus lexical. Although
>> a top level "(setq x 5)" does not declare the symbol x
>> special, Lisp nevertheless treats it as a special variable.
Sorry, I meant to say "as a dynamic variable". In
the vocabulary I've been trying to use, variables
are either lexical or dynamic. special is a declaration
of a symbol.
> No, Lisp does *not* treat it as a special variable, at least not as
> defined in the spec. If it did, the following would return 2:
> (setf x 1)
> (defun foo () x)
> (let ((x 2)) (foo))
> but it doesn't, it returns 1.
I meant to say "dynamic variable."
So, (setf x 1) treats x as a dynamic variable, and sets
the (top-level) value to 1.
(let ((x 2)) (foo)) treats x as a lexical variable, and
so creates a lexical scope in which there is a lexical
variable named x, which is not referenced anywhere.
In foo, there is an undeclared free reference. Now,
what is CCL supposed to do with that? I don't think
it's clear that that's valid Common Lisp. What CCL
actually does is consistent with what it does with
the (setf x 1), namely, see that there is neither
a lexical context with a variable named x, nor
a special declaration for the symbol x, and treat x as a dynamic
variable despite the lack of a declaration.
> That may be true, but I don't think you will be helping matters if you
> deliberately use words to mean something other than their established
I'm using defintions that were established for a long time.
The CL Hyperspec is, unfortunately, not using these
established words. However, by explaining it the
way I am (modulo the mistake that I made in the
previous mail, sorry!), I think I can explain what CCL
does in a consistent way.
>> That (setq x 3) is not well-defined is, to me, unsatisfactory.
> But it *is* well defined. It is possible to describe exactly what
> (setq x 3) does. The only problem is that what it does isn't
> consistent with the spec, and doesn't have a name.
By "not well-defined" I meant "not defined clearly by the CL Hyperspec".
> Happily, we don't have to wonder what "establish" means. The spec
> defines it:
> establish v.t. to build or bring into being a binding, a declaration,
> an exit point, a tag, a handler, a restart, or an environment. ``let
> establishes lexical bindings.''
> To my ear, that sounds pretty much the same as "create". But the spec
> also defines "declare" and "proclaim" so we don't have to wonder what
> those words mean either. The authors of the spec were remarkably
Well, the bottom line is that I think that the spec,
taken as a whole with the glossary entry, is
confusing and/or inconsistent with the usage
that I am accustomed to and used for the Lisp
machine documentation. There's not much
point in carrying this discussion any further;
so I'm done with this.
More information about the Openmcl-devel