[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Common Lisp should use lexical scoping
- To: Common-Lisp@SU-AI.ARPA
- Subject: Common Lisp should use lexical scoping
- From: masinter.pa@Xerox.ARPA
- Date: Thu, 11 Apr 1985 22:42:00 -0000
I think Common Lisp should use lexical scoping and not dynamic scoping.
Dynamic scoping is the cause of some subtle incompatibilities between
compiled and interpreted code.
Of course, I'm not talking about the scoping of variables, but rather of
packages. The "package" of a piece of code is really a lexical property
of the code. The fact that packages are dynamic in extent rather than
lexical has led to almost all of the problems in defining what happens
to packages and the compiler.
I believe that lexical scoping for packages would require some extra
syntax. I'm not sure I'm up for proposing what that syntax should be,
but I'd guess that some kind of reader macro(s) would be appropriate
replacements for the Extremely Random User Interface Commands. (Imagine
"#;;;-*- Package:" as a reader macro.)
It would then be reasonable to expect the compiler to preserve the
lexical scoping of packages, but the mechanism can now be part of the
It would remove the odd restrictions on the compiler mechanisms (as
suggested by the implementation note in CLTL p 182) and much of the
necessity for having some of the more arcane features of the Packages