There seems to be a discrepancy between what keyword names are
supposed to be allowed, according to the reader documentation, and
which the reader actually allows.  For instance, periods are supposed
to be disallowed in keyword names, and only one forward slash allowed,
but no errors are thrown at something like this:

{:f/o/o.o :bar}

The key :f/o/o.o is interpreted as a keyword with namespace f/o and
name o.o

Using the keyword function, we seem to be able to make keywords out of
any pair arbitrary strings, even including spaces.  This might seem
pathological, but since keywords just evaluate to themselves there
doesn't seem to be great harm in allowing this kind of liberal
behavior.  (Note also that keywords don't create a namespace, so we
don't have to worry about inadmissible namespaces for keywords.)

On the other hand, if this isn't to be allowed, then shouldn't the
keyword function throw an error when inadmissible strings are provided
for namespaces or names?  I should point out that the symbol function
is also similarly permissive, and that seems like it might be more
worrisome.  I would be in favor of keeping the behavior of the keyword
function as is, but possibly making the symbol function a bit
stricter.

Note, I'm using version 1.2.  This all is motivated by a stackoverflow
discussion: 
http://stackoverflow.com/questions/3951761/what-are-the-allowed-characters-in-a-clojure-keyword/

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to