> Just FYI, some background on keywords that start with a number...
> 
> The reader docs (http://clojure.org/reader) states that symbols (and keywords 
> follow symbols in these rules) must "begin with a non-numeric character".


Thanks, Alex. The REPL-y and sjacket issues cited the Clojure issues in Jira 
and I looked through them.

There seems to be an assumption in the discussion I've seen that the current 
description of keywords at http://clojure.org/reader means that the characters 
*after* the leading colon in a keyword have to follow the rules for a symbol.

I think another reasonable way to interpret the description of keywords is that 
the spelling of a keyword *including the leading colon* has to follow the rules 
for a symbol -- with the obvious exception that a symbol's spelling *cannot* 
begin with a colon. Since a colon is always non-numeric, keywords *always* pass 
the "begins with a non-numeric character" test.

When I looked in the past at what it takes to parse a token in Clojure, I 
concluded that the syntax of numbers vs. non-numbers (including the syntax for 
numbers with a radix component) was chosen such that a token represents a 
number if and only if it has a leading numeric character. I've always 
interpreted the "no leading numeric character" rule for the spelling of symbols 
(and keywords, including the leading colon) as in support of that simple 
distinction. More generally, the reader can classify a token by its leading 
character, or leading 2 characters in the case of a leading #.

I don't see a similarly compelling reason to disallow numeric characters 
immediately after the leading colon in a keyword.

--Steve

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to