From the documentation it says that
The
refresh
function will scan all the directories on the classpath for Clojure source files, read theirns
declarations, build a graph of their dependencies, and load them in dependency order.
(refresh)
never reloads anything for me. Am I using it wrong?
For repro I have two files:
a.clj:
(ns refreshdoesntwork.a)
(defn get-a-map []
{:a "a"
:b "q"}) ; change q to b, just save file,
; then I expected (refresh) in namespace b to react.
b.clj:
(ns refreshdoesntwork.b
(:require [clojure.tools.namespace.repl :refer [refresh]]
[refreshdoesntwork.a :refer [get-a-map]]))
(refresh)
(println (get-a-map))
Actual behavior:
file b, get output {:a a, :b q}
in file a, change :b "q"
to :b "b"
save the file
run (reload)
in b
run the print funtion in b
then the problem, I get the output {:a a, :b q}
Nothing is updated.
Using deps.edn,
org.clojure/tools.namespace {:mvn/version “1.1.0”}
org.clojure/clojure {:mvn/version “1.10.3”}
on WSL with Calva