Dynamic namespaces via exceptions

Avi Bryant avi.bryant at gmail.com
Sat May 14 10:54:41 UTC 2005


On 5/14/05, Alexandre Bergel <bergel at iam.unibe.ch> wrote:
> Hello Trygve,
> 
> You reproduced the mechanism of Lisp for resolving variable. This means that in Lisp, whenever you write the name of a variable, you do not know statically to which variable you are referring to. Whereas in Scheme, as in Smalltalk, you can statically determine to which variable a name is bound.

To broadly call this the "Lisp" mechanism is a little misleading: most
modern lisps are lexically scoped, like Scheme and Smalltalk, not
dynamically scoped (IIRC, one exception in common use is elisp, the
language used by emacs).  But yes, the original Lisp was dynamically
scoped, and it's still common in the Lisp world to use the occasional
dynamically scoped variable - Scheme usually does this with the
fluid-let binding form (as opposed to the normal "let", which is a
lexically scoped binding), and Common Lisp calls these "special
variables".

There's an implementation of this for Squeak on SqueakMap called
DynamicBinding.
It's a useful construct, and it's rare that I have a project where I
don't use it at least once (though much more than that doesn't seem
like a great idea).

Avi



More information about the Squeak-dev mailing list