Hi Konrad, Okay, I think I was just being dense. I thought you were talking about a different macroexpansion strategy, rather than just doing full macroexpansion without interleaved compilation. Thanks for your patience in explaining what you meant.
I will note, though, that &env is an implicit argument to the macros, so anything which works "exactly" like the compiler needs to mimic that as well. Zach On Thu, Sep 5, 2013 at 3:09 AM, Konrad Hinsen < googlegro...@khinsen.fastmail.net> wrote: > ** > Zach Tellman writes: > > > I guess I'm confused, then. You contrast "complete recursive > > expansion" with what the compiler does, and then say it's recursive > > prewalk expansion, which is exactly what the compiler does. Can > > you clarify the difference between what you're doing and what the > > compiler does? > > Here's an example: > > (defmacro foo [x] > `(list ~x ~x)) > > (defmacro bar [x] > `[~x ~x]) > > Now let's work on the form > > (foo (bar 'baz)) > > Plain macroexpand returns > > (list (bar 'baz) (bar 'baz)) > > whereas tools.macro/mexpand-all gives > > (list ['baz 'baz] ['baz 'baz]) > > It does this by first calling macroexpand, so foo gets called exactly > as during Clojure compilation and returns > > (list (bar 'baz) (bar 'baz)) > > mexpand-all then goes through that form and expands the two subforms > (bar 'baz). > > So mexpand-all does exactly what the compiler does, in particular it > calls the macros with exactly the same arguments. But the compiler > interleaves macro expansion with compilation, so it never gives you > access to the fully expanded but uncompiled form which is > > (list ['baz 'baz] ['baz 'baz]) > > Konrad > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/a68aThpvP4o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.