[Openmcl-devel] Compiler warnings
ron at flownet.com
Mon Oct 19 21:30:23 EDT 2009
On Oct 19, 2009, at 11:15 AM, Daniel Weinreb wrote:
> Tim Bradshaw wrote:
>> One of the most annoying things about SETF at the top-level in CMUCL
>> is that it does (or did) effectively declare the name as special.
>> That can have fairly pervasive and unfortunate side-effects.
>> So it's a good thing it does not do this in CCL.
> I agree strongly. In fact, having SETF at top level
> cause a declaration to happen is extremely confusing.
Yes, but it is defensible behavior in light of what the spec says,
namely (section 18.104.22.168.1):
"If a form is a symbol, then it is either a symbol macro or a variable."
"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.
In fact, if one does not conclude this and simply does what CCL does
(which I agree is reasonable behavior) then one is outside the spec.
You have a thing that acts like a variable, but does not act like any
of the three kinds of variables that the spec defines. (Hence my
claim earlier in this thread that a variable created this way is
neither lexical nor dynamic).
> This is a much more profound issue than the question
> of when warnings are emitted. The warnings are less
> profound because they do not actually have any effect
> on the outcome of the program.
> In Taoufik's defense, this stuff really is pretty confusing.
Indeed it is. Taoufik's problem was not that he was confused. That
happens all the time, and it's exactly why I wrote up the Idiot's
Guide. Over the years I have not had even a SINGLE INSTANCE of
someone who actually read the Idiot's Guide and still reported being
confused afterwards. Taoufik's problem was that he refused to do his
homework and kept insisting that he understood the problem better than
anyone who was trying to answer him.
> First, the CMUCL behavior makes it very different from
> anything else.
But the only one whose behavior is defensible according to the spec.
> Second, I can see how it would be easy
> to think that the presence or absence of warnings meant
> something more than it actually did.
[I'm under a severe time constraint as I write this so I'm going skip
over a bunch of stuff]
> Note: Talking about Lisp "creating a variable" can be
> confusing. Symbols are created by the reader, at
> read time.
But symbols are not variables.
> Symbols can be used for many things.
> Sometimes, symbols are interpreted as variables,
> depending on the context in which they are seen.
> There isn't quite anything that is best called "creating
> a variable".
No, that's not true. When you create a binding or use DEFVAR or
DEFCONSTANT you are creating a variable. The problem is that there is
no way to create a global variable whose name is a symbol that is not
pervasively declared special without going beyond the behavior
specific in the spec. But users want that behavior.
> I hope this helps.
Here is my attempt at cutting through this Gordian knot:
More information about the Openmcl-devel