Specifically allow '.' inside keywords

Description

The documentation for keywords (on page http://clojure.org/reader) specifically states that '.' is not allowed as part of a keyword name; however '.' is specifically useful. For example, several web frameworks for Clojure use keywords to represent HTML elements, using CSS selector syntax (i.e., :div.important is equivalent to <div class='important'>).

In any case, the use of '.' is not checked by the reader and it is generally useful.

I would like to see '.' officially allowed (in the documentation). Further, I'd like to see additional details about which punctuation characters are allowed (my own web framework uses '&', '?' and '>' inside keywords for various purposes ... again, current reader implementation does not forbid this, but if a future reader will reject it, I'd like to know now).

Environment

None

Activity

Show:

Alex Miller May 29, 2024 at 2:18 PM

Updated docs to remove this line from the keyword section:

"They cannot contain '.' in the name part, or name classes."

Arne Brasseur January 19, 2022 at 8:45 PM

Rich posted in 2008 that:

As far as '.', that restriction has been relaxed. I'll try to touch up
the docs for the next release.

Link:

Current reader docs are here:

But still say that keywords

cannot contain '.' in the name part, or name classes.

Vitalie Spinu August 1, 2016 at 8:35 PM

It's worth noting that the most common prefix character '#' is allowed in keywords by the reader, but other prefix characters '`', '@' and '~' are not. None of these characters are allowed as part of symbols proper.

Howard Lewis Ship April 15, 2013 at 11:56 AM

Unfortunately, the EDN specification does not mention '>'.

Devin Walters October 21, 2012 at 12:46 AM

I think the EDN spec mitigates some of the concern, but as of yet the official clojure.org reader documentation does not reflect the language used in the description of EDN. Where does EDN stand right now? Can the description being used on the github page be pulled over to clojure.org?

References:

Fixed

Details

Assignee

Reporter

Priority

Created December 1, 2011 at 5:09 PM
Updated May 29, 2024 at 2:19 PM
Resolved May 29, 2024 at 2:19 PM