Re: Order of macroexpansion



Rainer Joswig <joswig@xxxxxxx> writes:

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.

or might or might not have it too:

(defmacro outer (arg &body body)
`(progn
,@body
(macrolet ((inner (&whole w arg) `(print ',w)))
,@body)))

(macroexpand '(outer 10 (inner +1)))
--> (PROGN (INNER 1) (MACROLET ((INNER (&WHOLE W ARG)
(LIST 'PRINT (LIST 'QUOTE W)))) (INNER 1))) ;
^^^^^^^^ ^^^^^^^^^
| |
+-- let's say you've got inner here. |
but what is this? ---------+

;-)


--
__Pascal Bourguignon__
.



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)
  • 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)
  • 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)