On Dec 22, 9:01 am, Randall R Schulz <rsch...@sonic.net> wrote:
> On Monday 22 December 2008 05:51, Mark Volkmann wrote:
>
> > On Sun, Dec 21, 2008 at 2:30 PM, Randall R Schulz <rsch...@sonic.net>
> wrote:
> > > On Sunday 21 December 2008 11:33, chris wrote:
> > >> ...
>
> > >> That answers my question. Don't use a namespace, and the keyword
> > >> is global. Pass in a namespace, and the keyword is in that
> > >> namespace.
>
> > > Yes, the default namespace for keywords is different than for
> > > symbols, which is why the ::keyword form exists.
>
> > Can you explain what ::keyword does? I haven't encountered that
> > before and can't find any documentation on it.
>
> Rick and Stuart H. should answer, but as I understand it, instead of the
> default "global" namespace (no namespace at all):
>
> 1:1 user=> (namespace :keyword)
> nil
>
> or an explicit namespace:
>
> 1:2 user=> (namespace :space/keyword)
> "space"
>
> the ::keyword notation yields a keyword in the current namespace (that
> in effect when the form containing the double-colon keyword is
> compiled):
>
> 1:3 user=> (namespace ::keyword)
> "user"
>
This conversation is way off track.
Symbols and keywords are not 'in' namespaces, they are not interned in
namespaces, there are not lists of, e.g. keywords in a particular
namespace.
They are simple, two part names. The first part is the namespace part,
and may be nil, the second part is the name part.
::kw is just a shorthand for saying: a keyword whose name part is "kw"
and whose namespace part is the same as the name of the current
namespace.
:kw is a keyword with no namespace part.
:foo/bar is a keyword with a namespace part of "foo" and a name of
"bar". It's just a value, it is not 'in' foo.
Symbols are similar, they are just names.
Rich
--~--~---------~--~----~------------~-------~--~----~
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
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---