[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


In a deep-bound Lisp, it is critically important to be able to distinguish 
"global" access/update from "special", or "fluid" access/update.  A note 
I sent to the CL mailing list about a year ago stressed this point; it
explained the semantic differences and showed some performance consequences.
There were not many replies about it since almost all Common Lisps are 
currently shallow-bound [the upcoming Xerox effort will be an exception, 
and some parallel research versions of Common Lisp are also an exception]

Since none of these proposals for clarifying the semantics of undeclared
variables propose to do away with "special" variables, then the question 
of global/fluid distinction for "specials" is still relevant.  So I'm a 
bit concerned about the proposal to add yet a third environment, the 
"global lexical", which doesn't address this concern.

Consider, for a moment, the example:
   (let ((x 1))
     (declare (special x))
     (load "some-file"))
where the contents of "some-file" are
   (setq x (+ x 3))
The historic interpretation is that this SETQ applies to the special
binding of x.  To get the effect of setting the global "fluid" binding,
one would have to say something like 
  (proclaim '(global x))
  (setq x (+ x 3))
or like
  (locally (declare (global x)) (setq x (+ x 3)))
or use functions like Interlisp's "topval" functions:
   (settopval 'x (+ (gettopval 'x) 3))
In this example, it would/should be illegal to lambda-bind x if it were 
declared "global"; thus it is quite satisfactory to use the shallow-binding 
value cell as both the "global" cell and the "special" cell;  For many 
reasons, it is very convenient to have the "top-level" fluid environment 
be the same as the global environment.  

That's why I'm a bit taken aback by your proposal that the "global lexical" 
could not share with the global dynamic (fluid) environment.  Whereas there 
is the demonstrated need for a declaration which distinguishes special 
variables from global variables, where is the need for a distinct, yet 
parallel, global lexical environment?

-- JonL --