ns-unmap-all

Yametazamwa mara 99
Ruka hadi kwenye ujumbe wa kwanza ambao haujasomwa

blais

hayajasomwa,
11 Sep 2010, 21:48:3511/09/2010
kwa Clojure
Hi,
The following function has been a real _lifesaver_ lately in debugging
symbol collisions in (ns) directives when developing with SLIME in a
long-running VM:

(defn ns-unmap-all
"Unmap all the symbols (except 'ns' and 'in-ns')."
([] (ns-unmap-all *ns*))
([ns] (map #(ns-unmap ns %) (keys (ns-map ns)))))

May I kindly suggest the inclusion of something similar along with all
the other core namespace functions?
It's quite nice (IMHO: necessary) to be able to get back to a clean
environment when you face a collision error.
(I'm guessing may of you have something similar already defined in
your environments.)

cheers,

Stuart Sierra

hayajasomwa,
12 Sep 2010, 15:21:0112/09/2010
kwa Clojure
This will help with collisions, but note that other namespaces may
still hold references to the values of the un-mapped Vars.
-S

Stuart Sierra

hayajasomwa,
12 Sep 2010, 15:22:0812/09/2010
kwa Clojure
There's also "remove-ns" in core, which, when followed by "ns", will
have the same effect.
-S

On Sep 11, 9:48 pm, blais <martin.bl...@gmail.com> wrote:

Phil Hagelberg

hayajasomwa,
12 Sep 2010, 16:18:1612/09/2010
kwa clo...@googlegroups.com

I've had this on my todo list for swank-clojure for a while now; would
love to see a patch that integrates it. Not sure it belongs in
clojure.core though.

-Phil

Robert McIntyre

hayajasomwa,
12 Sep 2010, 16:52:0912/09/2010
kwa clo...@googlegroups.com
shouldn't we rename remove-ns to ns-remove to keep it in line with the
other ns functions?

--Robert McIntyre

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Laurent PETIT

hayajasomwa,
13 Sep 2010, 03:39:2913/09/2010
kwa clo...@googlegroups.com
Yes.

And you should consider wrapping the call to map into (dorun) so that you're sure that once the function exits, all the ns-umap calls are done.

2010/9/12 Robert McIntyre <r...@mit.edu>

Meikel Brandmeyer

hayajasomwa,
13 Sep 2010, 04:13:5213/09/2010
kwa Clojure
Hi,

On 13 Sep., 09:39, Laurent PETIT <laurent.pe...@gmail.com> wrote:

> And you should consider wrapping the call to map into (dorun) so that you're
> sure that once the function exits, all the ns-umap calls are done.

> > >> (defn ns-unmap-all
> > >>  "Unmap all the symbols (except 'ns' and 'in-ns')."
> > >>  ([] (ns-unmap-all *ns*))
> > >>  ([ns] (map #(ns-unmap ns %) (keys (ns-map ns)))))

In fact you should use doseq. dorun is so ugly.

Sincerely
Meikel

Laurent PETIT

hayajasomwa,
13 Sep 2010, 04:19:2013/09/2010
kwa clo...@googlegroups.com
indeed

2010/9/13 Meikel Brandmeyer <m...@kotka.de>

--
Jibu wote
Mjibu mchapishaji
Sambaza
Ujumbe 0 mpya