Thomas F. Burdick <tfb@conquest.OCF.Berkeley.EDU> wrote:
| Pascal Bourguignon <email@example.com> writes:
| > tfb@conquest.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
| > > firstname.lastname@example.org (Rob Warnock) writes:
| > > > +---------------
| > > > | (setf (symbol-value 'x) 6)
| > > > +---------------
| > > >
| > > > There is no defined behavior in the absence of a global definition
| > > > of "x", e.g., "(defparameter x 6)" perhaps. And if you *do* replace
| > > > the SETF with a DEFVAR, then CLISP gives the same result as the others.
| > >
| > > I've seen statements like this before, but I can't think of anything
| > > in the spec that supports such a statement. Certainly, I don't see
| > > anything on the SYMBOL-VALUE page. Am I forgetting something obvious
| > > somewhere else?
| > I guess the point (of specifying undefined behavior in that case) is
| I guess I didn't make myself clear enough. Stephen Halfich and Barry
| Margolin understood what I was saying, but apparently you got it
| inside-out. So, I'll try again, this time less diplomatically:
| Rob Warnock's post above is incorrect. SETF of SYMBOL-VALUE is not
| the same thing as making a free reference to a variable, although most
| (all?) implementations interpret the latter as being equivalent to the
| former. SETF of SYMBOL-VALUE's behavior is defined over the domain of
| *all* symbols.
You're absolutely correct! My apologies, I misspoke! I used a completely
bogus example to make my real point [thus confounding the whole issue].
Burdick and others have made similar points as well. Let me try again...
From the CLHS Glossary, we have:
value n. ... 3. (of a symbol) the value of the dynamic variable
named by that symbol.
value cell n. Trad. (of a symbol) The place which holds the
value, if any, of the dynamic variable named by that symbol,
and which is accessed by symbol-value. See cell.
So clearly, if X is a dynamic variable in some dynamic binding
contour, then (setf (symbol-value 'x) 6) will set the value that
is returned by a naked reference to X in that same dynamic scope.
But since there is no such thing in the CLHS as a "global lexical
variable", it is undefined whether in the absence of a declaration
of X in the current scope a free reference to X should be treated
as dynamic, lexical, or throw an "unbound" exception. In *any* event
(symbol-value 'x) must return the most recent value set in the
current synamic scope.
Is that better, or have I just made things more muddled?
Rob Warnock <email@example.com>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607