On Jun 16, 2009, at 1:42 PM, pmf wrote:

I've noticed that clojure.lang.Namespace cannot be used with the name-
function (like (name *ns*)) because it does not implement
clojure.lang.Named. One has to use (.getName *ns*), which is a bit
ugly.

I've had this same thought in the past, but the Named interface returns strings from its .getName and .getNamespace calls:

        user=> (show clojure.lang.Named)
        ===  public abstract interface clojure.lang.Named  ===
        [ 0] getName : String ()
        [ 1] getNamespace : String ()
        nil

Subclasses of Named are named by either one string (when not namespace qualified) or by two strings (when namespace qualified).

In contrast, the name of a namespace is a symbol:

        user=> (class (.getName *ns*))
        clojure.lang.Symbol

Given that difference, it would not be appropriate for clojure.lang.Namespace to implement clojure.lang.Named.

As Meikel mentioned, Clojure provides ns-name for this purpose.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to