There's really two questions in there as I see it.
1. Why doesn't the go macro expand all nested macros.
2. Why can't the go macro find the <! and >! anyway

I don't know the answer to either, unfortunately.

Because macro expansion happens in reverse order to normal evaluation,
nested macros aren't normally expanded. Why it doesn't manually expand
nested macros, I don't know, but I guess perhaps its to avoid compile-time
overhead to using core.async if it has to macroexpand-all every form inside
a go block?
I do remember seeing someplace that Rich or others may have purposely left
it as it is to force channel operations to always happen at the top level.
This makes sense, if true, because nesting the <! and >! operations means
that you lose a lot of purity and the code (not to mention the core.async
code) would easily get complicated. But as you say, while this applies to
functions, macros should really live outside that restriction.

As for #2, I haven't a clue. I mean, surely if go does not expand the
macros it would walk the tree and find the <! and >! anyway. I didn't think
about this yesterday, but now I wonder why it doesn't.


On 22 July 2014 15:05, Tom Locke <[email protected]> wrote:

> Thanks for your reply. That's pretty much what I'd come to understand. I'm
> a bit puzzled why this restriction exists though. Of course function calls
> can't be resolved at macro expansion time, so it makes sense that >! & <!
> inside functions can't be found. But I don't understand why the go macro
> cannot first expand all nested macros and then apply its transformations to
> the result.
>
> Indeed, clojure.walk contains macroexpand-all specifically for this kind
> of situation, or that's what I had understood.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to