Alice <dofflt...@gmail.com> writes:

> (defmacro foo
>   [c]
>   `(<! ~c))
>
> (let [c (chan)]
>   (go (prn (foo c)))
>   (>!! c :hi))
>
> I thought this would not work because foo is expanded after go is expanded, 
> so <! isn't visible to go.
> What am I missing?

`go` explicitly macroexpands the form given to it rather than relying on
the standard outside-in macroexpansion order.  You can see that in the
clojure.core.async.impl.ioc-macros namespace, i.e., there's an `expand`
function called by the :list implementation of the -item-to-ssa
multimethod.

Bye,
Tassilo

-- 
-- 
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.


Reply via email to