Subject: Re: Controlling the expansion of a macro
From: Erik Naggum <erik@naggum.net>
Date: 2000/07/08
Newsgroups: comp.lang.lisp
Message-ID: <3172062051359271@naggum.net>

* 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.