[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(see below)

To: Common-Lisp
From: Stephen Bacher at Draper Lab
Subject: Lexical references in DEFMACRO - reply to a previous message from
Dave Moon

> I think if you actually write out the seemingly obvious defmacro, you
> will see that it's not so:
>       (defmacro foo-p (x) `(and (listp ,x) (eq (car ,x) unique-id))))
> which does not reference unique-id as a variable from the body of
> the macro, only from the expansion of the macro.

I don't see what Dave Moon is trying to accomplish here.  The point of
the discussion is whether you can reference lexical variables in the
expansion function, not in the expanded body - of course you can't
reference the lexical variable in the expanded code!  So, if DEFMACRO
uses a null lexical environment, you can't reference UNIQUE-ID, and if
it doesn't, you can, and the appropriate macro definition to test this
should be:

 (defmacro foo-p (x) `(and (listp ,x) (eq (car ,x) ',unique-id)))

MC.LCS.MIT.EDU is flakey.  We may have missed mail that would make
the above comment moot.  Please remove  KSH@MC.LCS.MIT.EDU  from
the Common-Lisp distribution and add   Hvatum@MULTICS.MIT.EDU
instead.  Thanks.