When we write a symbol in the UUID literal, the reported error message is wrong
(as of 1.11.1)
clojure -M -e '#uuid id'
Execution error (AssertionError) at clojure.main/main (main.java:40).
Assert failed: (string? form)
It is wrong because
It should be something like this
Reader error (AssertionError) at clojure.uuid/default-uuid-reader (uuid.clj:12).
Assert failed: (string? form)
A second step improvement could be add spec support to data-literals, as macros do.
Syntax error reading #uuid id at (REPL:1)
id - failed: string? at: [:form]
From #clojure-dev slack channel
Alex: You don’t need anything special there - just an instrumented spec on the data reader fn
After run
(s/fdef clojure.uuid/default-uuid-reader :args (s/cat :form string?))
(clojure.spec.test.alpha/instrument `clojure.uuid/default-uuid-reader)
The message turns into
Syntax error reading source at (REPL:2:1).
Call to #'clojure.uuid/default-uuid-reader did not conform to spec.
This is a way better message.
Also, it includes a #:clojure.error{:phase :read-source}
in ex-data.
So the fix could be just add a spec to clojure.uuid/default-uuid-reader