>>>>> "Holger" == Holger Schauer <schauer(a)coling.uni-freiburg.de> writes:
>>>>> "MS" == Michael Sperber schrieb am 18 Aug 1998 11:08:25 +0200:
MS> Sure, but there's no guarantee that a given macro has hygienic
MS> behavior. Generally, maintaining hygiene this way is pretty
MS> tedious, which is why programmers usually don't go to the
MS> necessary lengths.
Holger> I will make a risky statement: a powerful tool should be used
Holger> carefully. What you say is certainly true, but - as Paul Graham makes
Holger> clear - macros are a way to fool with the way lisp evaluates your
Holger> statements. To me, this is like a big red sign yelling: "Careful".
Yeah, just like there was been a big red sign saying "use the keymap
abstractions when you deal with keymap instead of treating them like
ordinary sequences."
This is certainly a fashionable attitude in the textual-macro camp. I
would agree more if there wasn't a superior alternative.
Holger> I believe that even in the Elisp programming style tips people
Holger> are advised not to use macros if they can be avoided. One
Holger> example that has bitten me much to often was the useless use
Holger> of macros in mailcrypt or in some VM file, IIRC, which broke
Holger> whenever I installed a new VM version. Therewas absolutely no
Holger> reason to use macros in that places. Your example below is of
Holger> the same class:
It's an *example*. Of course, there's no *need* to use a macro,
because there's no need for the code in the first place. What's your
point?
MS> (defvar bar 23)
MS> and I want to refer to bar (that is, the above binding) in a
MS> macro body:
MS> (defmacro foo () 'bar)
MS> ... but I do:
MS> (let ((bar 42)) (foo)) => 42
Holger> Excuse me, but this is evil by design.
Absolutely right, Common Lisp's macro system is evil by design. In
Scheme,
(define bar 23)
(define-syntax foo (syntax-rules () ((foo) bar)))
(let ((bar 42)) (foo))
=> 23
Holger> Brr, what awful code.
No, it isn't. There are many perfectly valid reasons for a macro to
refer to an outer binding within the same lexical scope. I just want
macros to obey the same scoping rules as the rest of the language, and
they don't in Common Lisp.
--
Cheers =8-} Chipsy
Friede, Völkerverständigung und überhaupt blabla