Fork me on GitHub
#cljs-dev
<
2020-09-15
>
dominicm15:09:20

https://clojurians.slack.com/archives/C06E3HYPR/p1600154539042500 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.

borkdude16:09:29

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

dominicm16:09:29

In this case, the cljs compiler gets to choose.

dominicm16:09:35

As it manually calls read.

plexus16:09:53

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

dominicm16:09:39

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.

dominicm16:09:11

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.

lilactown16:09:49

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.

dominicm16:09:19

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.

dominicm16:09:52

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.

dominicm16:09:01

This would alleviate that problem.