-
Notifications
You must be signed in to change notification settings - Fork 22
Namespaces should be reloaded after compilation #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for bringing this up! Let me explain my reasoning. Previous versions of Virgil were Leiningen-centric, and the lein-virgil plugin was the primary driver of the recompilation process. Because the customization options of a plugin are very limited, it made sense to provide namespace reloading out-of-the-box because users didn't have the ability to do it on their own. The new version of Virgil supports both Leiningen and tools.deps and no longer ships a plugin. Users are expected to control Virgil from the REPL which gives much more flexibility. For example, in the basic case of manually calling (do (virgil/compile-java ["src"])
(clojure.tools.namespace.repl/refresh-all)) I think this flexibility is beneficial for several reasons:
Regarding the automatic Virgil recompilation workflow with (virgil/watch-and-recompile ["src"] :post-hook #(clojure.tools.namespace.repl/refresh-all)) Finally, regarding tools.namespace dependency itself. I'm not a fan of bringing unnecessary transitive dependencies, and it is especially so for tools.namespace itself and also for |
Just a question here. Is '(clojure.tools.namespace.repl/refresh-all)' taking care of this as well ? |
Right, refreshing the namespaces "updates" the class shortname aliases to the newly compiled classes. |
I'm fine with more flexibility, but I'd argue that some sort of auto-refresh is a big part of the ergonomics of the library. I think you should add your comment (or some version thereof) to the README, if that's how you imagine it being used. I completely missed the sentence about |
I noticed that when I was using the newer version of Virgil, I had to manually reload the namespace before the recompiled class was available. Part of the intended workflow is that the updated classes should be immediately available. It appears that you removed this functionality when doing the refactor, but I assume that was unintentional? If not, we can discuss this further.