Considering that the only effect of adding a namespace to keyword is
to ensure it doesn't inadvertently equal some other keyword (e.g., :a-
ns/foo doesn't equal :foo nor :b/foo), I'm not clear on what kind of
conflation you're concerned about.

Also note that the namespace portion of a keyword does not get
resolved against the current aliases.  E.g.,
user=> (require '[clojure.java.io :as io])
nil
user=> (= :io/foo :clojure.java.io/foo)
false


On Sep 19, 1:06 pm, Kyle Schaffrick <[email protected]> wrote:
> On Sun, 19 Sep 2010 12:22:54 -0700 (PDT)
>
> ataggart <[email protected]> wrote:
> > Unlike symbols, keywords just evaluate to themselves. The keyword :foo
> > will not collide with a var foo, likewise keyword :my-ns/foo will not
> > collide with var my-ns/foo.  So, if I understand you correctly, :xsl/
> > value-of would work just fine.
>
> Right, I understand that the keyword and the symbol themselves are
> distinct. I guess what I'm asking about is the meaning of their
> namespaces to the evaluator, and probably is best illustrated like this:
>
>   user=> (require '[some.library :as xsl])
>   nil
>   ;; now the namespace "xsl" has semantic meaning on symbols when
>   ;; they're evaluated in this context:
>   user=> #'xsl/value-of
>   #'some.library/value-of
>
> Is there any situation where, in that examaple, the namespace "xsl" on
> a keyword such as :xsl/value-of might be conflated with the namespace
> alias "xsl" that I created with require? Or, does Clojure consider
> keyword namespaces to be completely meaningless and opaque, the same
> as it does with their names?
>
> I can't find any situation where the two blur together except for
> the ::keyword syntax, but I suspect this is nothing more than a
> superficial syntactic trick. Still, I want to make sure I'm not missing
> something.
>
> -Kyle
>
>
>
>
>
> > On Sep 19, 11:56 am, Kyle Schaffrick <[email protected]> wrote:
> > > Would it be correct to say that the namespace portions of keywords
> > > are semantically opaque?
>
> > > In other words, if I have a keyword :my-ns/foo and a symbol
> > > 'my-ns/foo, obviously the namespace in the symbol has semantic
> > > meaning to the language when it's evaluated (or syntax-quoted), but
> > > the namespace of the keyword does not appear carry that meaning,
> > > almost as if they are in two separate "meta-namespaces". Is that
> > > pretty much guaranteed as far as the language is concerned?
>
> > > I'm asking because I've become the latest in the line of Clojurians
> > > to go tilting at the "SXML-in-Clojure" windmill, and if I decide
> > > use the namespace portion of a keyword (for example :xsl/value-of)
> > > I want to be certain it's always distinct in meaning from any
> > > Clojure namespaces or aliases of the same name.
>
> > > The code I teased apart into this library currently uses keywords
> > > like :xsl:value-of to distinguish XML namespaces from Clojure
> > > namespaces, just as a matter of "that was the first thing I thought
> > > of", but it would certainly be saner to stop wasting effort
> > > splitting them apart by hand with string munging and simply bestow
> > > my own meaning on the keywords' namespaces if the language itself
> > > doesn't give them any meaning.
>
> > > Thanks,
> > > -Kyle

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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