There's actually a lot of history and several open tickets about this 
specific question of whether keywords can start with a digit. The original 
intent (and the reader reference page) is that it would match symbols in 
that leading digits are not allowed. However, there is a bug in the regex 
that lead to them being accepted.

We tried to fix this bug several years ago and it broke a lot of existing 
code that was relying on the ability to do this. We decided at that point 
that there was no reason to take this away. The lingering tickets are to 

a) fix the regex to do this on purpose rather than on accident (and this is 
also the reason why some of your examples work and some do not)
b) update the reference pages to explicitly include this
c) sync up edn rules with clojure rules

So, if you want to be really safe and "to the spec" right now, then I would 
say, don't use leading digits in keywords. Realistically though, we're 
never going to disallow those and eventually I expect them to be 
"officially" ok. 

For leading digits in namespaces, that may actually violate Java package 
rules, in which cases we would not be able to allow that.

On Friday, March 2, 2018 at 12:35:26 AM UTC-6, wrote:
> Thank you both for the links, especially the FAQ page. As an aside I was 
> looking for something like the namespace function and am glad I found it.
> Something is still confusing me however. If we follow the reader docs 
> which Alex posted, "Symbols begin with a non-numeric character", and 
> "Keywords are *like* symbols" (emphasis mine, this may be open to 
> interpretation) hence also shouldn't begin with a non-numeric character. 
> But if you try the following in either Clojure or (Script)'s REPLs, they 
> work just fine:
> :0
> ;= :0
> Further, using the respective reader-string functions also yields:
> (read-string ":0")
> ;= :0
> So this would indicate that whatever is written in the docs is not 
> necessarily being enforced in the reader, is that correct?  

> It seems that as far as the reader is concerned, keywords can begin with a 
> numeric but the name portion (after the /) of a namespaced keyword can't. 
> In other words :0 is legal, :a/0 isn't. 
> Interestingly enough, 
> :0/a
> ;= :0/a
> is also legal within each language's reader.
> In which case, why are :0 and :0/a legal but not :a/0?

Note that posts from new members are moderated - please be patient with your 
first post.
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at

Reply via email to