Fork me on GitHub
dominicm15:09:20 Would it make sense for ClojureScript to use the :cljs branch for reading data_readers.cljc? Or would it use the :clj branch? I can see an argument for both.


I guess it's always read-time which is before macro time, so probably only :clj unless self-hosted


In this case, the cljs compiler gets to choose.


As it manually calls read.


Would it work to use the cljs branch? The referenced functions may not exist on the Clojure side


Well, I suppose the real intention of setting :cljs would be that you could mark the intended audience of the reader cond, rather than how to read the symbol it references.


That is, I'd still expect the symbol referenced to be read in Clojure (as that's where the compiler lives), I'm just saying that it's the data reader for clojurescript to use.


I think there’s an argument about consistency there. Everywhere else the compiler will take the :clj route when reading & executing JVM clojure code. for :cljs I would expect that code to be executed in a JS runtime.


Yeah, that's the other argument. But I also think that's a special file, and being able to distinguish the target reader is massively valuable in this situation.


I previously asked about how to write data readers which work in clj & cljs, and it's not currently possible as clj uses objects and cljs uses code forms.


This would alleviate that problem.