The Clojure core.async captures bindings at the beginning of the go block.
This could be done in ClojureScript core.async as well but it needs
language support to do this correctly and efficiently.

David


On Thu, Sep 5, 2013 at 10:48 AM, Meikel Brandmeyer (kotarak) 
<m...@kotka.de>wrote:

> Hi,
>
> Am Donnerstag, 5. September 2013 16:36:37 UTC+2 schrieb Mathias Picker:
>
>> I just tried this test case (from Anderkent on IRC):
>>
>> (def pingc (chan))
>>
>> (def ^:dynamic *text* "OUPS BAD ASYNC")
>>
>> (binding [*text* "good boy"]
>>   (go (while true
>>         (<! pingc)
>>         (js/alert *text*))))
>>
>> (defn ping []
>>   (put! pingc :ping))
>>
>> (ping)
>>
>> and I get "OUPS BAD ASYNC".
>>
>> So, is this bug in cljs core.async?
>>
>>
> This is to be expected, because the binding is reverted after the go call
> returns. So the code in the go block (executed later on) sees the old,
> initial binding.
>
> Meikel
>
>
> --
> --
> 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.
>

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