On Nov 14, 2008, at 11:21 AM, [EMAIL PROTECTED] wrote:

> Okay, maybe I have not caught on the semantics of (use) and (refer).
> Let me extend my example a bit.
>
> File home/a.clj:
>
> (ns home.a
>  (:refer-clojure :exclude (load)))
>
> (defn load [] 'my-load)
> (defn other-fn [] 'other-fn)
>
> Then, I start a fresh REPL and:
>
> user=> (use :verbose ['home.a :as 'a])
> (clojure.core/load "/com/benoithamelin/trunk/a")
> java.lang.IllegalStateException: load already refers to:
> #'clojure.core/load in namespace: user (NO_SOURCE_FILE:0)
> (clojure.core/in-ns 'user)
> (clojure.core/alias 'a 'com.benoithamelin.trunk.a)
> (clojure.core/refer 'com.benoithamelin.trunk.a)
>
> (The five lines following the invocation are printed along the
> execution of the (use) application.)  So, the exception that is thrown
> does not interrupt the execution of the (use) application, which
> surprises me.

That surprises me too. I'll take a look at why that is.

> Moreover, it refers all the mappings in home.a to the
> current namespace.  I thought that the [... :as ...] clause mapped
> each public mapping m of home.a to a/m; not to the current namespace.

Your model of what's going on would be true if you called "require"  
instead of "use". "use" also refers the loaded namespace(s) into the  
current namespace.

--Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to