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

EVAL-WHEN



    Date: Thu, 3 Apr 86 18:23 -EST
    From: David A. Moon <Moon at SCRC-STONY-BROOK.ARPA>
    To:   Common-Lisp at SU-AI.ARPA
    Re:   EVAL-WHEN

        A couple of other questions have been asked before and never really 
        answered.  Are EVAL-WHENs allowed down in the guts of a function or 
        macro and what do they mean there?  

    The discussion on page 66 that everybody hates was intended to rule out
    EVAL-WHEN inside the guts of a function or a macro.  I cannot think of
    a meaningful interpretation of EVAL-WHEN in this position.

We may have to come up with a meaningful definition for non-top-level
EVAL-WHEN's.  The reason is that the notion of a top-level form is
fairly worthless once you allow definitions inside of LET's.
Forbidding non-top-level EVAL-WHEN's would prohibit non-top-level use
of all user defining macros which expand into EVAL-WHEN's.  This is
unacceptable since most hairy defining macros use EVAL-WHEN.

It is possible to meaningfully define non-top-level EVAL-WHEN's.  The
LOAD and EVAL cases are easy: just compile or eval as PROGN (modulo
the situation interaction hair).  The problem arises with the COMPILE
situation.  The solution I suggest is to evaluate every EVAL-WHEN
COMPILE at compile time, no matter where it appears.

    (1) The name of EVAL-WHEN leads to confusion since this special form is
    not actually related to the EVAL function.  Should this problem be attacked
    by changing the name or by documenting it better?
EVAL-WHEN is far too obscure to be completely understood by anyone
who hasn't written it.  Changing the name certainly won't help; better
documentation might.

    (3) It would be useful to have a way to turn off the compiler's normal
    processing of a form.  Some discussion of exactly what this means may be
    in order.
I agree.  I thing most of the "normal processing" can be modeled as
implicit EVAL-WHEN COMPILE's.  A possibility is to have a new
situation LOAD-ONLY which is like LOAD except that it inhibits
evaluation of all EVAL-WHEN COMPILE's (implicit or explicit) within
its lexical scope.  Compilation of code within LOAD-ONLY should have no
effect on the compiler environment.

If we make some changes along these lines, we can totally eliminate
the notion of a top-level form from the language.  I think this would
be a big improvement.

  Rob