>>>> "Craig" == Craig Lanning
<CraigL(a)internetx.net> writes:
Craig> At 02:00 PM 8/19/98 +0200, Michael Sperber [Mr. Preprocessor] wrote:
>>>>>> "Holger" == Holger Schauer
<schauer(a)coling.uni-freiburg.de> writes:
Holger> Which is of course possible if you use packages in CL ;-)
>
> Yeah, if I use explicit qualification, which amounts to not using the
> package system at all.
Craig> No it doesn't. It's a very important part of the package system.
Craig> How about this?
Craig> (defpackage pkg1 (:export foo))
Craig> (in-package :pkg1)
Craig> (setq bar 23) ; could be (defvar bar 23)
Craig> (defmacro foo () 'bar)
Craig> (defpackage pkg2 (:use pkg1 cl))
Craig> (in-package :pkg2)
Craig> (let ((bar 42)) (foo))
Can you elaborate what this does? Under CLISP, this yields:
#<PACKAGE PKG1>
Also, I couldn't find anything offhand in CLtL2 about the interaction
of macros and packages. Admittedly, I've been too lazy to dig up the
ANSI spec.
> So what's the politically correct way to define top-level
bindings
> which are not special in Common Lisp?
Craig> Why would you want them?
The problem with dynamic binding in Common Lisp is that a special
declaration makes a name be dynamically bound everywhere. So, when I
just look at a LET locally, I cannot tell whether it's a static or a
dynamic binding because a special declaration may be lurking somewhere
else without my knowing.
I use global variables all the time without wanting dynamic scope for
them. Unfortunately, declaring such a variable in Common Lisp (if I
understand you right) automatically changes the meaning of all other
LET bindings for the same name, even though they, by intention, have
nothing to do with the global variables.
Of course, this mechanism is necessary to keep compatibility with
older Lisps. From a fresher perspective, I conjecture it would be
better to make dynamic scoping explicit everywhere by introducing
extra binding and reference operators.
--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla