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

+2 votes
in Clojure by
retagged by

Q1: is there a particular reason the #uri edn extension was not provided in Clojure, given that clojure and clojurescript implement clojure.core/uri? on java.net.URI and goog.Uri?

Here is a gist documenting how to do it, with tests: HOWTO install #uri reader extension in Clojure/Script

Despite the instruction that "Reader tags without namespace qualifiers are reserved for Clojure" I thought this was safe, because if Clojure were to eventually provide it then: (1) this impl becomes superseded and should be removed; (2) this impl is intended to be the exact implementation that core would provide.

However Borkdude pointed out:

  • borkdude The problem is that you can't easily undo overriding built-in tags if people have data_readers.cljc stuff on their classpath that override
  • Dustin Getz Ah so if this extension ends up bundled as a transitive dependency in some lib
  • borkdude Yes. So even if you wish to remove it, as you know, software isn't killed that easily

Q2: Therefore I request this be considered to someday be provided in core

Q3: Is this the correct impl? (It's my intent to document this once and for all so I appreciate feedback/comments.)

Q4: transit-clj & transit-cljs decline to read java.net.URI and goog.Uri (in disalignment with the clojure.core/uri? predicate), instead reading as cct.Uri. Why is that?

1 Answer

+2 votes
by
selected by
 
Best answer

Q1 - PLEASE do not use unqualified data readers in implementing this yourself. Making a widespread extension like that would make it much more difficult for us to add it in core and/or cause lots of problems. That's the whole point.

Q2 - Added a jira https://clojure.atlassian.net/browse/CLJ-2731

Q3 - don't know, happy to have a Clojure-specific patch to review

Q4 - there's old history there, and I don't know or remember all of it, some parts of the decision may no longer be relevant. I know there are some issues on the transit repos about this

...