Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by
;; use number as namespace of a map's keyword is fine and outputs namespaced map
user=> {:3/a 1}
#:3{:a 1}

;; but the same namespaced map reader macro will not be accepted
user=> #:3{:a 1}
RuntimeException Namespaced map must specify a valid namespace: 3 clojure.lang.Util.runtimeException (Util.java:221)

2 Answers

0 votes
_Comment made by: jafingerhut_

I don't believe Clojure ever documented that it would support keywords like :3/a

I believe the reason that it does not cause an error is an explicit effort to avoid breaking some Clojure programs that came to rely upon this undocumented / unpromised behavior.  See comments on ticket CLJ-1252.  For officially supported characters in symbols and keywords, see the Symbols and Literals sections of this page: https://clojure.org/reference/reader

Disclaimer: I am not a decision maker in these matters.  I am only commenting to provide some background.

I would be somewhat surprised if a decision was made to support "#:3{:a 1}" in the Clojure reader.
0 votes
Reference: https://clojure.atlassian.net/browse/CLJ-2315 (reported by alex+import)