> I put your notes here, > http://dev.clojure.org/display/design/Dynamic+Binding
Thanks! > How are you ensuring that the binding frames are local to a particular > asynchronous block of code and that they are removed when that asynchronous > block of code exits? I don't do anything special for asynchronous code, this simply provides the primitives necessary. Which is, primarily, bound-fn. Which is, in turn, built on {get,pop,push}-thread-bindings. The logic is all taken from the JVM clojure implementation, with the main difference being that I didn't need the TBox class (see Var.java) since there are no threads in JavaScript land. bound-fn (and the binding and with-bindings macros) simply utilize the low level push/pop/get-thread-bindings to capture the immutable bindings hash as well as apply them when necessary. Finally blocks handle most of the popping magic... assuming that machinery works in all the various edge cases already (if not, it's an existing compiler bug). There is some future work, which requires far more thinking, to accomplish something akin to C#'s async/await keywords. These would likely be non-blocking/async variants of the futures/defer theme. Much more thought is required here before tackling that work. In the meantime, you can now use bound-fn instead of just #() or fn when defining callbacks, if you want to preserve the binding frame asynchronously. Does that answer your question? -- 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