Bond uses with-redefs which binds the function's var's root to the new definition, which means it is visible to all threads that are currently executing, not necessarily the one in the context of with-spy or with-stub, for example
(defn funk [& args] args)
(future
(bond/with-stub! [[funk (constantly -1)]]
(Thread/sleep 10000)
(funk)))
(funk 9) ;; => -1 (redefined function being called outside of with-stub)
;; after ten seconds
(funk 9) ;; => (9)
Bond uses with-redefs which binds the function's var's root to the new definition, which means it is visible to all threads that are currently executing, not necessarily the one in the context of
with-spy
orwith-stub
, for exampleI was curious if you think using thread-local redefinitions is something you think would be useful here. For example, using https://gist.github.com/gfredericks/7143494