How are consumers supposed to handle values with unrecognized tags?
ethanresnick opened this issue · comments
Is there some standard behavior that makes sense to have as the default? E.g., ignoring the tag, ignoring the value, erroring, etc.
When reading in the clojure reader the reader fails when it reads an unknown tag.
(clojure.edn/read-string "#unknown-tag [1 2 3]")
;; => Exception: No reader function for tag unknown-tag
You can, however give the reader a default tag, like tagged-literal
(clojure.edn/read-string {:default tagged-literal} "#unknown-tag [1 2 3]")
;; => #unknown-tag [1 2 3]
But this tagged litteral (of class clojure.lang.TaggedLiteral
) has no particular meaning inside your application, it just serializes to the same thing as it was read as.
So, no, there is no sane default here. If your application is unaware of the meaning of the data it shuffles around, fine, use tagged-litteral, otherwise you better give your EDN-reader the nescessary tag->function-mapping to parse the data.