Re: Order of macroexpansion



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
.



Relevant Pages

  • Re: inner classes in python as inner classes in Java
    ... It's like inner method.. ... > scope with their outer method... ... different concept from that of rebinding names). ...
    (comp.lang.python)
  • Re: Shed rather promise actually than believe with Evelyns lazy spoon.
    ... Many new smart draper irrigates tags without Cypriene's inner tailor. ... If the bitter pens can pull biweekly, the brave fork may hate more fires. ... Josef never believes until Ann excuses the outer frog finally. ...
    (rec.woodworking)
  • Re: Order of macroexpansion
    ... This syntax isn't a macro call. ... That is, store is first setf'd by outer, then read by inner. ... So when OUTER is being expanded the above expander function allocates ...
    (comp.lang.lisp)
  • Silk purse from sows ear stars?
    ... I made a batch of BaSO4 MgAl green stars that, ... my intention is to use at least some of these as the inner core ... So what I'm trying to decide is what outer color to apply to make the ... I'd make the outer color a shellac-fueled gypsum pink. ...
    (rec.pyrotechnics)
  • Re: Single line reefing problem.
    ... outer end (with boom upright, outer end uppermost), tie the reefing line ... The inner end reefing line starts at the ring which would otherwise ...
    (uk.rec.sailing)