How we could get out of the “already refers to” situation in Cider?
Quite often I am moving a function foo
from ns a
to ns b
and when in ns c
I am requiring (a :refer [foo]
instead of (a :refer [foo])
, CIDER complains:
Unhandled java.lang.IllegalStateException
foo already refers to: #'a/fo in
namespace: c
The only solution I found so far is to restart the REPL, which is a sacrilege!
CIDER isn't complaining. Clojure is. If you can get away from using :refer
you'll be fine. If not, there is ns-unmap
.
(ns-unmap 'c 'foo)
and then (require [new-ns :refer [foo]])
Thank you @dpsutton
Is there a way in Cider (or in Clojure) to clear completly a ns?
you could try cider-ns-reload
after changing the namespace to the new location of foo
. I don't know if that will work or not though
It doesn’t work
ah bummer. i'm not aware of anything then
I think you meant to say cider-ns-refresh
.
(that uses tools.namespace
internally)
There are some docs here https://docs.cider.mx/cider/0.26/usage/misc_features.html#reloading-code