>>>> "Holger" == Holger Schauer
<schauer(a)coling.uni-freiburg.de> writes:
>>>> "MS" == Michael Sperber schrieb am 26 Aug
1998 12:14:52 +0200:
MS> Can you explain to me why the above should lead to a different
MS> result? CLISP's output is exactly what I expected it to be:
MS> (setq bar 23)
MS> (defmacro foo () bar) ; this means (foo) expands to the value of BAR
Holger> Isn't this meant to mean to refer to the current binding of bar, which
Holger> in this case happens to be 23 ?
What do you mean by "current"? BAR is supposed to refer to the
binding introduced by (setq bar 23), which is the lexically enclosing
one. The question is: when is the binding resolved?
MS> (defun baz () (foo)) ; this therefore expands to (defun baz () 23)
^^^^^^^^^^^^^^^^^
This is the crux of the matter: Does the binding get resolved here?
MS> (baz) => 23 ; indeed
MS> (setq baz 42) ; the definition of FOO is unchanged
Holger> (I guess you mean bar, not baz).
Yes.
Holger> You are right, the definition of FOO is unchanged, it still
Holger> refers to the current binding of bar - which now happens to be
Holger> 42.
Sure, but I expanded FOO before I changed the binding. I suspect your
CL actually processes the forms in some weird order. In any case, I
strongly doubt that the CL standard mandates the behavior you
describe.
--
Cheers =8-} Chipsy
Friede, Völkerverständigung und überhaupt blabla