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

+1 vote
ago in Syntax and reader by
recategorized ago by

According to edn-format/edn specification

A reader should not call user-supplied tag handlers during the processing of the element to be discarded.

But with clojure.edn/read and its derivatives execute provided reader functions under discard tag:

user=> (clojure.edn/read-string {:readers {'foo (fn [val] (prn "!!!") val)}} "#_ #foo [1 2 3]")
"!!!"
Execution error at user/eval216 (REPL:1).
EOF while reading

The same happen with clojure.core/read and its derivatives:

user=> (binding [*data-readers* {'foo (fn [val] (prn "!!!") val)}] (read-string "#_ #foo [1 2 3]"))
"!!!"
Execution error at user/eval146 (REPL:1).
EOF while reading

I understand that Clojure' reader does not provide explicit description of what is executed during reading out form to be discarded except "The form following #_ is completely skipped by the reader." but I think it is worth to mention that here.

After realisation that this post is not qualifies as "ask"

To summarize:
Is this a bug in clojure edn specification implementation?
Is the edn specification no longer accurate?

1 Answer

0 votes
ago by
selected ago by
 
Best answer

This is definitely an appropriate thing to put on Ask Clojure and seems like a bug in the impl of the spec to me.

Logged as https://clojure.atlassian.net/browse/CLJ-2928

ago by
I cleaned up the ticket and added a patch.
...