Hi,

On 17 Aug., 13:39, Rasmus Svensson <r...@lysator.liu.se> wrote:

> (in-ns 'my-important-project.analysis-2)
>
> or simply use the ns macro:
>
> (ns my-important-project.analysis-2)

Please note, that these two are *not* equivalent!

With ns:

Clojure 1.1.0
user=> (ns foo.bar (:refer-clojure :exclude (map)))
nil
foo.bar=> (def map 5)
#'foo.bar/map
foo.bar=> (in-ns 'user)
#<Namespace user>
user=> (ns foo.bar)
java.lang.IllegalStateException: map already refers to: #'foo.bar/map
in namespace: foo.bar (NO_SOURCE_FILE:4)

With in-ns:
Clojure 1.1.0
user=> (ns foo.bar (:refer-clojure :exclude (map)))
nil
foo.bar=> (def map 5)
#'foo.bar/map
foo.bar=> (in-ns 'user)
#<Namespace user>
user=> (in-ns 'foo.bar)
#<Namespace foo.bar>

ns should really only be used to define a namespace. Then you should
use in-ns to switch namespaces in the Repl (or to ensure we are in the
right namespace at the top of a file, which is sucked in via load).

Sincerely
Meikel

-- 
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

Reply via email to