3 ms·
Every function in a protocol is namespaced. There's nothing preventing you from defining a new function with the same name in a different namespace. This does
by prospero 16y ago
Every function in a protocol is namespaced. There's nothing preventing you from defining a new function with the same name in a different namespace. This doesn't actually replace anything, though, and any references to the old function will have to be changed to point to the new one.
It is also possible to extend a protocol a second time for a given type/record, which will overwrite the previous implementation. This can be occasionally useful (mostly for incremental development), but for the most part runs counter to the philosophy of Clojure. Seeing it used in production Clojure code would raise a lot of alarm bells.
- kemiller 16y agoSo anything that requires changing all the references to the new one is a non-starter. I want something that lets me fix it in-place without going and hacking their source directly. If you could do something like "monkey patch this, but only for calling code inside my private namespace" that would probably get you 90% of the way there.