>>>> "Holger" == Holger Schauer
<schauer(a)coling.uni-freiburg.de> writes:
>>>> "MS" == Michael Sperber schrieb am 18 Aug
1998 14:52:08 +0200:
Holger> [Common Lisp and Elisp]
MS> (defvar bar 23)
MS> (defmacro foo () 'bar)
MS> (let ((bar 42)) (foo)) => 42
Holger> (foo) => 23
Holger> Excuse me, but this is evil by design.
MS> Absolutely right, Common Lisp's macro system is evil by design.
MS> I just want macros to obey the same scoping rules as the rest of
MS> the language, and they don't in Common Lisp.
Holger> Interesting. Seems I don't understand what you want to say.
Holger> (defvar bar 23)
Holger> (defun foo ()
Holger> bar)
Holger> (let ((bar 42)) (foo)) => 42
Holger> (foo) => 23
Holger> Where is the difference ?
I'm an idiot, and my Common Lisp is obviously rusty. I'm sorry. I
meant (setq bar 23) instead of (defvar bar 23).
Of course, in the case of dynamic binding, referring to a binding from
a macro does the right thing in Common Lisp.
MS> No, it isn't. There are many perfectly valid reasons for a macro
MS> to refer to an outer binding within the same lexical scope.
Holger> What are those reasons ? Why not use a different name in let ?
I don't understand that last sentence. If I create a package, and I
put abstractions in that package, may they be syntactic or semantic
abstractions, I want those abstractions to be able to access bindings
in the package.
Holger> You also have to when you use functions. This would introduce
Holger> a non-intuitive difference between the use of macros and those
Holger> of functions, if I understand you correctly. And you seem to
Holger> find some benefit in it: which is it ? [1]
Holger> [1] This is a serious question, I'm not trying to suggest that there
Holger> isn't a benefit.
Absolutely. I just fucked up the example. In the case of special
variables, you do want the macro to refer to the dynamically bound
version. Scheme doesn't have dynamic binding, so the Scheme example
was not a translation of the original CL example I gave. It is a
translation of the revised version. Again, sorry about creating such
confusion.
--
Cheers =8-} Chipsy
Friede, Völkerverständigung und überhaupt blabla