>
> The problem is dealing with with asynchronous code, right? Not capturing / 
> restoring dynamic bindings.
>

No, the problem is that there is no mechanism to capture and restore 
dynamic bindings.

This is a shortcoming irrespective of asynchronous code.

It just so happens that such a mechanism is necessary for writing code 
which sets a dynamic binding, then schedules asynchronous code which uses 
that binding.

Notice my example from above, here it is again in Clojure:

user=> (def ^:dynamic x "root")
#'user/x
user=> x
"root"
user=> #'x
#'user/x
user=> ((binding [x "dynamic"] (fn [] x)))
"root"
user=> ((binding [x "dynamic"] (bound-fn [] x)))
"dynamic"

Notice two things about this code:

1) It is completely synchronous and single-threaded.
2) Now works identically in both Clojure and my ClojureScript branch.

See (doc bound-fn)

You suggested that there is insufficient motivation for my changes in the 
face of CPS / delimited continuations. My question to you is: How would you 
implement bound-fn without doing exactly what my code already does?

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

Reply via email to