Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!ai-lab!zurich.ai.mit.edu!markf From: markf@zurich.ai.mit.edu (Mark Friedman) Newsgroups: comp.lang.scheme Subject: Re: Macros Message-ID: Date: 30 May 91 16:34:25 GMT References: <1490@yoakum.cs.utexas.edu> <1991May29.182453.24864@jato.jpl.nasa.gov> <1991May29.200957.27040@uicbert.eecs.uic.edu> Sender: news@ai.mit.edu Reply-To: markf@zurich.ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 56 In-reply-to: wilson@uicbert.eecs.uic.edu's message of 29 May 91 20:09:57 GMT In article <1991May29.200957.27040@uicbert.eecs.uic.edu> wilson@uicbert.eecs.uic.edu (Paul Wilson) writes: But I'll go ahead and take a position on lexical scope: If macros are to be lexically-scoped, the hooks should be built into the core compiler. It's absurd to implement a whole compiler- like prepass to do the necessary scope analysis. Just reify the compile-time environments and be done with it. (This is analogous to reifying closures and continuations -- you could always implement a language that has them as a prepass, but that's missing the point. The basic language should provide enough power to make it *easy* to implement useful things as extensions.) First off, I don't see that you are taking a position on lexical scoping of macros. It seems like you are taking a position on doing macro expansion during compilation. I have no strong argument against this, but I might mention that there are many Scheme implementations that do not have compilers. I'll also say that it just seems easier to do it in a pre-pass. The "scope analysis", as you call it is, is fairly trivial. Secondly, I'm not sure that I know what you mean by macros being lexically scoped. Do you mean nesting of macro definitions or do you mean what is usually called (at least in the Scheme community) hygenic macro expansion? The latter refers to the abilty (among other things) of having a macro like: (define-macro (or x y) `(let ((test ,x)) (if test test ,y))) work in the context of a call like: (or whatever test) where an unhygenic expansion would produce: (let ((test whatever)) (if test test test)) which is not what was intended. Hygenic macro expansion would produce something equivalent to: (let ((test-1 whatever)) (if test-1 test-1 test)) Thirdly, what compile-time environment are you talking about reifying? -Mark -- Mark Friedman MIT Artificial Intelligence Lab 545 Technology Sq. Cambridge, Ma. 02139 markf@zurich.ai.mit.edu