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

Defmacro inside of a let



    That's because the compiler wants to be able to evaluate macros at
compile time.  It would be impossible to compute the lexical
environment of a macro definition without actually interpreting the
surrounding code.  This is basically impossible, and is almost
certainly not what you want.  It is more obvious in the case of
MACROLET, which is usually embedded in random code somewhere.  This is
explained to some degree on page 114.

    If you really want a closure as macroexpansion function, you can 
(setf (macro-function 'foo) #'(lambda (form env) ...))
In this case there is no problem, since the macro won't be defined
until the form is evaluated, in which case its environment will be
available.

  Rob