Typing {:nil/a 1}
in the Clojure 1.10.1 REPL prints #:nil{:a 1}
.
But typing #:nil{:a 1}
gives me this error:
java.lang.RuntimeException: Namespaced map must specify a valid namespace: null
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Namespaced map must specify a valid namespace: null
clojure.lang.ExceptionInfo:
java.lang.RuntimeException: Unmatched delimiter: }
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unmatched delimiter: }
clojure.lang.ExceptionInfo:
(clojure.edn/read-string (pr-str {:nil/a 1}))
fails with the following exception:
java.lang.RuntimeException: Namespaced map must specify a valid namespace: null
This works with other namespaces, too:
(clojure.edn/read-string (pr-str {:1/a 1}))
; => java.lang.RuntimeException: Namespaced map must specify a valid namespace: 1
(clojure.edn/read-string (pr-str {:true/a 1}))
; => java.lang.RuntimeException: Namespaced map must specify a valid namespace: true
This doesn’t really make sense because (clojure.edn/read-string ":true/a")
works perfectly fine.