Re: Order of macroexpansion
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Thu, 31 Jan 2008 14:32:33 +0100
In article <47a1c9f7$0$90267$14726298@xxxxxxxxxxxxxxx>,
Peter Hildebrandt <peter.hildebrandt@xxxxxxxxx> wrote:
Say, I have the macros outer and inner, and I write the following:
(outer 10 (inner +1))
Is it specified, in which order outer and inner are expanded?
Outer is expanded. It returns a new form.
Whatever 'outer' returns will then be evaluated
as usual. Rember, the expansion of outer might
or might not have the 'inner' form.
I see.
that in sbcl outer is expanded before inner, and I can do the following:
(let (store)
(defmacro outer (val &body body) (setf store val) `(progn ,@body))
(defmacro inner (expr) `(,expr ,store)))
That is, store is first setf'd by outer, then read by inner.
Is this implementation specific, or can I rely on this?
If I have missed the obvious in the hyperspec, I'd be grateful for the
pointer.
Thanks,
Peter
- Follow-Ups:
- Re: Order of macroexpansion
- From: Pascal J. Bourguignon
- Re: Order of macroexpansion
- From: Peter Hildebrandt
- Re: Order of macroexpansion
- References:
- Order of macroexpansion
- From: Peter Hildebrandt
- Order of macroexpansion
- Prev by Date: Re: Security
- Next by Date: Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- Previous by thread: Order of macroexpansion
- Next by thread: Re: Order of macroexpansion
- Index(es):
Relevant Pages
|