Date: Thu, 27 Aug 1998 19:43:24 -0400
From: Craig Lanning <CraigL(a)internetx.net>
At 07:13 AM 8/27/98 -0400, Rick Campbell wrote:
From: sperber(a)informatik.uni-tuebingen.de (Michael Sperber [Mr. Preprocessor])
Date: 26 Aug 1998 14:20:32 +0200
I suspect your CL actually processes the forms in some weird
order. In any case, I strongly doubt that the CL standard
mandates the behavior you describe.
Common Lisp does not mandate much of anything regarding when expansion
occurs. It's an implementation detail, i. e. you should not write
code that depends on expansion happening at a certain time.
That's not really true. All forms are processed in order from left to
right. Macros are expanded as they are reached. In compiled code,
macros are expanded at compile time in such a way as not be expanded
at runtime.
I'm pretty sure that you're wrong about this. At the risk of being
hypocritical (I didn't cite spec), can you point to something in the
spec that dictates that in compiled code, macros *must* be expanded at
compile time. I believe an implementation is allowed to expand macros
at read time and then compile whatever's been previously expanded at
compile time, e. g.
* (defmacro foo ...)
* (defun bar () ... (foo ...)) ; expand macro here
* (defmacro foo ...) ; inconsistent with first definition
* (compile 'bar) ; uses first definition of foo cuz it was already expanded
At least, I've never seen spec saying the above is taboo and I believe
that I've seen discussion saying that it's allowed.
Rick