I don't have the answer, but perhaps a clue that might lead you to one: the function remove-lib inside of the tools.namespace library does this:
(defn remove-lib "Remove lib's namespace and remove lib from the set of loaded libs." [lib] (remove-ns lib) (dosync (alter @#'clojure.core/*loaded-libs* disj lib))) I suspect that perhaps since in your example REPL session you are not doing anything to change clojure.core/*loaded-libs*, that perhaps it still contains the namespace name on which you called remove-ns. *loaded-libs* is modified by functions used to implement the behavior of 'require', because require tries to avoid re-loading namespaces that have already been loaded earlier. Andy On Tue, Dec 19, 2017 at 2:14 PM, Mark Melling <mark.mell...@savageminds.com> wrote: > Hi, > > Apologies in advance for the possibly stupid question! > > I was having a problem with clojure.tools.namespace.repl/refresh where a > namespace that had been successfully loaded subsequently failed to be > reloaded when doing a repl/refresh. > > Whilst investigating the problem, (this is probably totally unrelated to > my issue), I realised I didn't understand how remove-ns and require > actually work. > > To illustrate this I did the following: > > (require '[foo.bar :as bar]) > => nil > (remove-ns 'foo.bar) > => #namespace[foo.bar] > (require '[foo.bar :as bar]) > => CompilerException java.lang.Exception: namespace 'foo.bar' not found, > compiling:(*cider-repl foo*:30:7) > > > > > So what does remove-ns do to cause the second require to fail? > > > > Thanks > > Mark > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.