Is there a way to unregister some names from a namespace without reloading it
?
This is a bit trickier than one might think. An example illustrates this;
Given two files, a.clj...
(ns a)
(defn stuff-a [] :stuff-a)
(defn hello [] :hello)
And b.clj...
(ns b)
(defn stuff-b [] :stuff-b)
Say we
Thx to all. ns-unmap and remove-ns are what i need.
From my CL experience i was looking for something like unitern.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to
Could some kind of :force true flag be generally interesting for the def
special form ? (:force true would force an unmap first, if necessary)
2009/8/29 Vagif Verdi vagif.ve...@gmail.com
Thx to all. ns-unmap and remove-ns are what i need.
From my CL experience i was looking for something
I often refactor my code and move some functions to new modules.
Unfortunately i cannot load them, because clojure says that function
with such name is already loaded from another namespace. I could not
find nothing better but to close my clojure session (which means bring
down the web server)
On Aug 28, 2009, at 11:55 PM, Vagif Verdi vagif.ve...@gmail.com wrote:
I often refactor my code and move some functions to new modules.
Unfortunately i cannot load them, because clojure says that function
with such name is already loaded from another namespace. I could not
find nothing
How about something like this?
user= (ns fun)
fun= (defn myfun [] 1)
fun= (defn myfun2 [] 1)
fun= (keys (ns-publics 'fun))
(myfun myfun2)
fun= (doseq [s (keys (ns-publics 'fun))] (ns-unmap 'fun s))
fun= (myfun)
java.lang.Exception: Unable to resolve symbol: myfun in this context
I use (remove-ns 'my-ns), then reload the entire file.
-Mike
--~--~-~--~~~---~--~~
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