When setting *default-data-reader-fn*
to tagged-literal
(as suggested in https://clojure.org/reference/reader#_default_data_reader_function) in a REPL like so:
user=> (set! *default-data-reader-fn* tagged-literal)
As advertised, the REPL can now read unknown tagged literals, e.g.:
user=> #foo 123
#foo 123
However, it fails when embedded in an expresson like so:
user=> (prn #foo 123)
Syntax error compiling fn* at (REPL:1:1).
Can't embed object in code, maybe print-dup not defined: clojure.lang.TaggedLiteral@34b5d34f
The hint in the error message works indeed, so when I provide:
user=> (defmethod print-dup clojure.lang.TaggedLiteral [tl w] (print-method tl w))
The REPL can now successfully read and eval the previous expression:
user=> (prn #foo 123)
#foo 123
nil
Should the print-dup
implementation for clojure.lang.TaggedLiteral
perhaps be provided by default?