On May 3, 2014, at 9:45 AM, Dave Tenny <dave.te...@gmail.com> wrote: > > The way I'm tempted to do this in clojure is > > (def ^{:dynamic true} *x* (atom 1)) > ... do stuff with @*x* ... > (reset! *x* 2) > ... do stuff with @*x* ... > (binding [*x* (atom 3)] (do stuff with @*x*))
Having also come from Common Lisp and having once done things similar to your suggestion in Clojure, I got burned by the fact (I *think* it was a fact) that "binding" created thread-local bindings that reverted to global bindings inside of code executed in another thread, e.g. in a pmap buried somewhere within the code executed within the binding form. I found this to be unexpected and problematic. Trying some simple examples with your outline, however, I don't see this happening. And I wonder if it's because of changes in more recent versions of Clojure related to ^{:dynamic true}. Does anyone know if the reversion of "binding"-bound vars to global bindings when crossing thread boundaries has really been eliminated? Or am I just not seeing it because my examples have been too simple? -Lee -- 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.