piggieback icon indicating copy to clipboard operation
piggieback copied to clipboard

Pretty printing of unknown tagged literals incorrectly handles string

Open plexus opened this issue 4 years ago • 0 comments

See https://github.com/lambdaisland/deja-fu#piggieback-printing

A literal like #time/time "10:11:12" will get parsed on the Clojure side to an UnknownTaggedLiteral, which then gets printed again. This printing on the Clojure side will output this as #time/time10:11:12.

This is the responsible handler:

(defmethod print-method UnknownTaggedLiteral
  [^UnknownTaggedLiteral this ^java.io.Writer w]
  (.write w (str "#" (.tag this) (.data this))))

I think the reason this implementation kind of works is because .toString on Clojure data structures yields a good serialization, but I think it would be better to recursively call print-method on (.data this). If that sounds reasonable I can make a PR for that.

plexus avatar Jul 02 '21 06:07 plexus