[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue EVAL-WHEN-NON-TOP-LEVEL, v2
- To: IIM@ECLA.USC.EDU, sandra%defun@cs.utah.edu
- Subject: Re: Issue EVAL-WHEN-NON-TOP-LEVEL, v2
- From: cperdue@Sun.COM (Cris Perdue)
- Date: Wed, 4 Jan 89 13:49:28 PST
- Cc: JonL@LUCID.COM, cl-compiler@SAIL.STANFORD.EDU
An aspect of Common Lisp's EVAL-WHEN has bothered me ever
since the first time I looked at it:
What if I define a macro that expands into an EVAL-WHEN --
suppose I wish to define a macro resembling defmacro,
say def-xxx-macro. Suppose that
(def-xxx-macro gogo (x) ... )
expands into:
(eval-when (compile load eval)
(setf (get 'gogo 'xxx-macro) (function (lambda (x) ... ))))
Now suppose it is something that, like defmacro, only affects
EVALuation and compilation, but my user has an application that
just runs compiled and doesn't need the definition.
I guess my user would like to say:
(eval-when (eval compile)
(def-xxx-macro gogo (x) ... ))
CLtL p.69-70 seems to strongly imply that (if the macro's expansion
counts as a top level form), my user can't turn off the load-time
action of def-xxx-macro.
Exactly the same problem exists if we wish to explain macros such
as DEFMACRO in terms of EVAL-WHEN.
I've always found that I wanted outer EVAL-WHENs to override inner
ones, due to examples such as this. Do others have different experience?
-Cris