You cannot do so in cljs though:
http://dev.clojure.org/jira/browse/CLJS-1634

Just in case you expect to write cross-platform code with dynamic bindings.


Am 16.03.2017 um 01:01 schrieb Timothy Baldridge:
> Yes, that should work fine, do your tests confirm otherwise? Also if
> you're not doing a recur there's no reason to use `go-loop` you can just
> use `go`.
> 
> On Wed, Mar 15, 2017 at 4:44 PM, Eran Levi <levi...@gmail.com
> <mailto:levi...@gmail.com>> wrote:
> 
>     Hi,
>     can I bind variables, same as I do for threads, for go routines, to
>     be local only for a particular go routine, and if I can't, how would
>     you mimic this behavior ?
> 
>     |
>     (defn print-stuff [s]
>       (println s))
> 
>     (go-loop []
>        (binding [*out*(clojure.java.io/writer "foo.txt")]
>           (print-stuff)))
> 
>     (go-loop []
>        (binding [*out*(clojure.java.io/writer "bar.txt")]
>           (print-stuff)))
>     |
> 
> 
>     -- 
>     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
>     <mailto: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
>     <mailto:clojure%2bunsubscr...@googlegroups.com>
>     For more options, visit this group at
>     http://groups.google.com/group/clojure?hl=en
>     <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
>     <mailto:clojure+unsubscr...@googlegroups.com>.
>     For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> 
> 
> 
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
> 
> -- 
> 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
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


-- 
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/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to