Why have dynamically bindable vars they aren't dynamic by default? (yes, yes, that ship has sailed, but applying these :dynamic metadatas is somewhat ... arbitrary)
But, I think the decision has been made and I don't have any evidence
that any of the above theoretical argument actually matters in
practice. I'm interested to see whether this is actually an issue or
not.
> --
> You received this message because you are subscribed to the Google Groups
> "Clojure Dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/clojure-dev/-/CDOBYxwQW6gJ.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to
> clojure-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/clojure-dev?hl=en.
>
Muddying the decision further, binding semantics for ClojureScript are different entirely - dynamic with no metadata annotation.
I think the counter-argument is that it takes away some of the
wonderful flexibility of Clojure in a way that external users of the
code cannot control or get back. For generic libraries intended to be
reused by others, it's quite possible that many of the vars could
*potentially* need to be dynamic for the purposes of testing, or code
coverage tools, or profilers, or something we can't think of now.
But, I think the decision has been made and I don't have any evidence
that any of the above theoretical argument actually matters in
practice. I'm interested to see whether this is actually an issue or
not.
And you are working too hard. Core already has with-redefs.
All that said, this scenario calls for dynamic binding (or an atom). You aren't hacking a fn to stub it out for testing, you are registering a replacement fn in a way intended by the original lib author.
Stu