I'm sending a corrected version of the wrapper, because the original
doesn't show errors returned by (refresh), and these are actually
critical. The corrected version:
:init (do
(require '[clojure.tools.namespace.repl :refer [refresh]])
(defn r []
(let [result (refresh)]
Thanks for the wrapper, that turned out to be the problem with 'user'
namespace I was REPLing in (other namespaces were refreshed as expected).
While resolving this I also found out that :after option of refresh
function is indeed useful (my server was re-created with older version of
ring handler
Here's a wrapper over (refresh) that updates the aliases in the user namespace
as well. You can put it in the :repl-options in your project.clj.
:init (do
(require '[clojure.tools.namespace.repl :refer [refresh]])
(defn r []
(refresh)
; https://github.com/cloju
Hi Petr,
Did you see this?
https://github.com/clojure/tools.namespace#warnings-for-aliases
Also mentioned: "Aliases to reloaded namespaces will break if the
namespace containing the alias is not reloaded also."
I've been writing per-project wrappers over the refresh function to do
the ns-unalias
Hello.
I experienced non obvious behavior of "require namespace as alias" when
using clojure.tools.namespace.repl/refresh.
If I use aliased namespace then after changing source files and call to
refresh I seem to have old values in that alias. If I use plain require all
seem to work as expected