re: binding behavior, I've only been using clojure since 1.5.1, but in my travels I get the impression that the binding form didn't always enforce the variable to be declared dynamic, and so maybe didn't behave the way you'd expect if the ^:dynamic was missing from the target of the binding form. Just guessing.
On Sat, May 3, 2014 at 11:08 AM, Lee Spector <lspec...@hampshire.edu> wrote: > > 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 a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/Wh1M345Y5u4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > 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.