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

"lexical" globals?

    Date: Tue, 17 Dec 85 10:50:24 pst
    From: edsel!jonl at su-navajo.arpa (Jon L White)

    Perhaps you, and/or the other people who have volunteered opinions on this 
    topic, can comment on whether a GLOBAL declaration, in parallel to the SPECIAL
    declaration, would be satisfactory; or whether there is a need for a more 
    scheme-like mechanism also.

I liked your message.  I think that a (PROCLAIM '(GLOBAL FOO))
proclamation would do the trick.  A DEFGLOBAL macro analogous to DEFVAR
would be convenient, and symmetrical with DEFVAR and the other DEF's.

Much as I like the feature, I think that adding the full generality of
the MIT/Yale Schemes' fluid-let would confuse too many people and anger
too many implementors.  I only mentioned it for its educational value.

As far as forbidding LAMBDA-binding of globals, this hadn't occurred to
me, but it's probably the right thing, for similar reasons.  Again, I'm
a fan of block structured languages, but Common Lisp simply is NOT block
structured, and this feature would be too confusing.  Forbidding
lambda-binding globals sort of defeats the idea of lexical scoping, but
then so does (PROCLAIM '(SPECIAL ...)).  Also, it's a conservative
approach, since it doesn't preclude possible later relaxation of the

If Common Lisp hadn't re-cycled LAMBDA for the two different purposes of
lexical and dynamic binding, we wouldn't be having these problems now.
But c'est la vie.  I can't really complain, since I didn't make a stink
about it when the decisions were being made.  Maybe we'll get it right
next time around.