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

Defmacro inside of a let

    Date: Monday, 3 February 1986  18:11-EST
    From: Rob Vollum <vollum at scrc-pegasus>
    Re:   Defmacro inside of a let

    I may be missing something here, but it seems to me that the compiler 
    wants to process ALL toplevel forms at compile time. Of course the
    compiler would have to interpret the surrounding code to calculate the
    lexical environment. I don't see why this is basically impossible. This
    is exactly what was being discussed in the recent "Defun inside LET"

Well, the compiler does need to Process all top-level forms, but that
certainly doesn't normally entail EVAL'ing them.  The compiler cannot
randomly eval any code just because it feels like it.  Normally the
compiler only evals forms if an explicit EVAL-WHEN (COMPILE) is
present.  Are you suggesting that the compiler should say "Oh, there's
a DEFMACRO buried in here somewhere, I'd better eval this thing."  If
so, that seems linguistically quite unclean to me, since the presence
of a defmacro would have a nonlocal effect.

This isn't the same as DEFUN inside of LET, because DEFUN has no
effect at compile time.  The actual evaluation of the defun is put off
until load time, when it is legal to evaluate the entire form.