[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Should (EVAL-WHEN (EVAL LOAD) mumble) = mumble?
- To: Common-Lispfirstname.lastname@example.org
- Subject: Should (EVAL-WHEN (EVAL LOAD) mumble) = mumble?
- From: ASemail@example.com
- Date: Mon, 22 Oct 1984 15:15:00 -0000
- Source-info: From (or Sender) name not authenticated.
As far as I can tell from reading the definition of EVAL-WHEN, the form
(EVAL-WHEN (EVAL LOAD) mumble) is always equivalent to an unadorned mumble.
Specifically, if the interpreter sees this EVAL-WHEN, it will evaluate mumble
(since EVAL is specified); if the compiler sees this EVAL-WHEN, it will
process mumble in the same mode as the EVAL-WHEN form (either NOT-COMPILE-TIME
or COMPILE-TIME-TOO). In either case, the interpreter and compiler process
mumble just as they would if mumble appeared by itself, without being wrapped
in EVAL-WHEN. Does anyone disagree with this interpretation of the
If this interpretation of the definition is correct, then I would argue that
the definition is not the right one. PSL has a similar notion called
LOADTIME, but its effect is different. Specifically, (LOADTIME mumble)
instructs the compiler as follows: (1) If mumble would normally be evaluated
at compiletime, then do not perform that evaluation; (2) generate code to
evaluate mumble at load-time, even if such code would not normally be
generated. In Common Lisp terms, assuming this macro definition,
(DEFMACRO FOO () `(EVAL-WHEN (EVAL COMPILE) (*FOO)))
(EVAL-WHEN (EVAL LOAD) (FOO))
would NOT invoke *FOO at compile time, and WOULD generate code to invoke *FOO
at load time. (In the PSL example I actually encountered, FOO was not a
macro, but a function flagged as implicitly EVAL-COMPILE.)