Hi Simon,

in-ns and ns are special cased for convenience. Usually in-ns is used to enter 
a namespace that has already been loaded, so that core names are available. For 
example:

;; in a file
(ns my.ns)

;; stuff

(comment
  (require 'my.ns)
  (in-ns 'my.ns)

  ;; tests
)


Stu

> Hi.
> 
> I'm learning Clojure, currently using Clojure 1.2.
> 
> http://clojure.org/namespaces when talking about creating
> namespaces says:
>  At the Repl it's best to use in-ns, in which case the new
>  namespace will contain mappings only for the classnames
>  in java.lang. In order to access the names from the
>  clojure.core namespace you must execute
>  (clojure.core/refer 'clojure.core).
> 
> Given the above, in the following...
> _________________________________________
> |
> | user> (in-ns 'my-new-ns)
> | #<Namespace my-new-ns>
> |
> | my-new-ns> (in-ns 'user)
> | #<Namespace user>
> |_________________________________________
> 
> ...how does the second in-ns get resolved?
> For comparison, use of most other operators from my-new-ns gives
> resolution errors. For example:
> _________________________________________
> |
> | my-new-ns> (+ 1 2)
> | ;; Evaluation aborted. Unable to resolve symbol: + in this context
> |_________________________________________
> 
> -- 
> 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

Stuart Halloway
Clojure/core
http://clojure.com

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