Fork me on GitHub

Greetings, I have a quick question with aleph's http client. Is there a way to keep binding conveyance (like you get in other clojure core stuff)? Don't have much experience with it and wondering if it's even possible.

(def ^:dynamic *val* :a)
(binding [*val* :b]
   (aleph/get "")
   (d/chain (fn [_] *val*))
   deref)) ; returns :a but want to keep :b


@alvin.francis.dumalus no - deferred's result in callbacks under the hood, and the callback may be processed on a different thread, so dynamic bindings will not generally be visible


bound-fn might be ok in some simple cases, but as soon as you start composing with promises you are in trouble again - i've found it easier to stay away from dynvars altogether