"require" and "use" support a ":reload-all" flag that is intended to cause the specified libs to be reloaded along with all libs on which they directly or indirectly depend. This is implemented by temporarily binding a "loaded-libs" var to the empty set and then loading the specified libs.

AOT compilation added another "already loaded" mechanism to clojure.lang.RT.load() which is currently not sensitive to a "reload- all" being in progress and breaks its operation in the following case:

        A, B, and C are libs
        A depends on B. (via :require in its ns form)
        B depends on C. (via :require in its ns form)
        B has been compiled (B.class is on classpath)

At the repl I "require" A which loads A, B, and C (either from class files or clj files)
        I modify C.clj
At the repl I "require" A with the :reload-all flag, intending to pick up the changes to C C is not reloaded because RT.load() skips loading B: B.class exists, is already loaded, and B.clj hasn't changed since it was compiled.

I'd like to add an issue for this to the Clojure project and supply a patch to fix it. My current patch creates a "*reload-all*" var with a root binding of nil and code to bind it to true when the current thread has a :reload-all call pending. When *reload-all* is true, RT.load() will (re)load all libs from their ".clj" files even if they're already loaded.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to