There is a function in a library I am using that I want to have rebound to a
function of mine for all threads, and can't seem to figure this out, or if
it is even possible.  binding, push-thread-bindings, in-ns with def, etc.
are not working, seemingly because they are only rebinding for the current
thread, but I don't know.

This is what I have tried, without success:

(clojure.lang.RT/var "other-ns" "other-fn" my-ns/my-fn)
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(push-thread-bindings {(var other-ns/other-fn) (var my-ns/my-fn)})
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(in-ns 'other-ns)
(def other-fn my-ns/my-fn)
(in-ns 'previous-ns)
(some-other-ns/fn-using-other-fn params)
;; still uses original binding

(binding [other-ns/other-fn my-ns/my-fn]
  (some-other-ns/fn-using-other-fn params))
;; still uses original binding

Is what I am trying to do possible?

Thanks.

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