[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Common Lisp should use lexical scoping
- To: masinter.pa@XEROX.ARPA
- Subject: Common Lisp should use lexical scoping
- From: "Scott E. Fahlman" <Fahlman@CMU-CS-C.ARPA>
- Date: Sat, 13 Apr 1985 02:29:00 -0000
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: Msg of 12 Apr 1985 19:09-EST from masinter.pa at Xerox.ARPA
- Sender: FAHLMAN@CMU-CS-C.ARPA
Maybe I misunderstand what you mean by "lexical scoping" of packages,
since your proposal was not spelled out in detail. But here's what I am
When we're speaking of the scope variables, lexical scoping means that
the scope of the variable is one contiguous chunk in the file being
read, and once you leave the lexical block you can never again get hold
of that variable by using its name (though function closures defined
within the block can still get at the variable). You cannot sneak in
one more function later that refers to the same X. That's awkward at
times, but also an advantage, since the compiler can be sure that after
it has reached the end of a block, it knows all about how a lexical
variable in that block can be referenced.
In lexically scoped packages, presumably this property would be
preserved. So you would have to load all of the contents of a package
in a single chunk, even if this stuff comes form several files.
After you exit the lexical scope of a package, presumably you could
never again go back and add a new symbol to it, though I suppose the
reader could still refer to existing symbols in that package.
(Otherwise, the whole package could just be thrown out after you exit
That might possible make sense if you are thinking only of reading a
bunch of existing files into the Lisp, but when you are developing code
that perhaps lives in several packages, you need to be able to bounce
back and forth between packages, adding new stuff to each package. I
don't see any way to do this without some sort of dynamic scoping of
Perhaps I have totally misunderstood your proposal?