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

Top-level forms and eval-when in the compiler

    There are various forms (defconstant, defmacro, eval-when) which
can cause things to happen in the compiler environment when they are
encountered.  When at top-level, the correct action seems clear, but
anyplace else things become more confusing.  What should be done when
a random (eval-when (compile) ...) is encountered during the
compilation of some function?  Does the compiler always do
compile-time evaluation even though the code might be unreachable?

    I don't think that it is acceptable to say that these forms are
only meaningful at top-level.  In a lexical lisp it is quite
useful to put a definition inside of a let.  Often user-defined
definition forms contain eval-whens.