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.  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.
So I try this:

user=> load
#<core$load__1811 [EMAIL PROTECTED]>
user=> a/load
#<a$load__2622 [EMAIL PROTECTED]>
user=> a/other-fn
#<a$other_fn__2625 [EMAIL PROTECTED]>
user=> other-fn
#<a$other_fn__2625 [EMAIL PROTECTED]>

The three first results are expected, but shouldn't the fourth
expression throw a "name not found in this namespace"?

Again, thank you for bearing with me on this.
Benoit
--~--~---------~--~----~------------~-------~--~----~
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
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