From ...
From: Erik Naggum
Subject: Re: Controlling the expansion of a macro
Date: 2000/07/08
Message-ID: <3172062051359271@naggum.net>#1/1
X-Deja-AN: 644021549
References: <51hfa5rbnd.fsf@zip.local>
mail-copies-to: never
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsmaster@eunet.no
X-Trace: oslo-nntp.eunet.no 963084403 22885 195.0.192.66 (8 Jul 2000 19:26:43 GMT)
Organization: Naggum Software; vox: +47 8800 8879; fax: +47 8800 8601; http://naggum.no; http://naggum.net
User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7
Mime-Version: 1.0
NNTP-Posting-Date: 8 Jul 2000 19:26:43 GMT
Newsgroups: comp.lang.lisp
* Pekka P. Pirinen
| The definition of MACROLET says "The macro-expansion functions
| defined by MACROLET are defined in the lexical environment in which
| the MACROLET form appears.", so it definitely does not include the
| names defined by the MACROLET form itself.
I've been reading this over several times, and I cannot fathom how
you conclude what you do. Without the "not", it seems abundantly
clear, however. I read it to state that macrolet does not create a
_new_ lexical environment, but rather to use the lexical environment
the macrolet appears in, which means that all the macros are
available simultaneously at _expansion_ time.
I'm not sure what the confusion is, but there is clearly a confusion
when referring to "recursive" macros. Let me illustrate what I mean:
(macrolet ((foo (x) `(progn (bar x) (first ,x)))
(bar (x) (ignore-errors (foo x)))
(zot (x) `(foo ,x)))
(let ((y (list 1 2 3)))
(zot y)))
A call to bar yields an error, as expected, but a call to zot
expands to (progn nil (first y)), also as expected, which means that
(1) the call to bar from foo happens at macro-expansion time, when
bar is defined, (2) the call to foo from bar refers to a foo outside
the lexical scope of the macrolet which doesn't exist, and (3) the
call to foo from zot happens at macro-expansion time.
I find all of this eminently supported by the standard, so I'm not
even sure what Pekka is arguing against, either.
#:Erik
--
If this is not what you expected, please alter your expectations.