Hi, Am 18.05.2009 um 09:47 schrieb Mark Engelberg:
As an example, I authored clojure.contrib.math. Someone came up with a slightly faster algorithm for one of the functions (which is used in turn by other functions in the library), but I can't include it unless he signs a contributor agreement. If he wants to create his own version of the module for his own personal use, in which he swaps out my function for his faster one, there appears to be no good way to do this, short of copying my entire file, commenting out my function, and replacing it with his. Clearly this is not an acceptable solution, because then he won't benefit from any future updates I make to the module. He can't use the "load" trick, all because of the (ns clojure.contrib.math) declaration at the top of the file. Based on this discussion, it sounds like I (and all library authors) should have provided all of my math functions in one file (say, math_functions.clj), and then had a separate file (math.clj) containing: (ns clojure.contrib.math (:load "math_functions")) just to make it possible for users to get at my code in its uncompiled, unlinked-to-clojure.contrib.math-namespace form for the purposes of incremental extension. If all library authors want to start doing this, I guess that's one solution. I'm just hoping there is a better way.
I think the right way of this scenario is called quilt, hg patch queue or StGIT. If you don't want to use this, there is the in-ns trick to modify the desired functions. In any case, modifying the inner workings of another library is only a ugly hack. Making such things easy wouldn't be my main priority if I were a language designer. But this is of course not very helpful to your original problem. I have some gut feeling, that you try to transport some notion, which just doesn't work in Clojure that way. I got the impression that the dependencies of your modules look like this: Analysis -> Solve -> Create If that is true, you should maybe consider some glue. /- Analysis Glue -- Solve \- Create The Glue part combines/uses the different modules. There you could change parameters easily with binding, swap in another analysis module, whatever... But the impression I got, might also be wrong. Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature