data_readers.cljc doesn't provide a way to have target-specific behaviour

Description

There is a cljs ticket to track the same issue: https://clojure.atlassian.net/browse/CLJS-3294

Description from that ticket:

I would like to have a data_readers.cljc file that provides tagged-literals for clojure and clojurescript.

possibly this should work for the contents of data_readers.cljc?

{foo/bar #?(:clj my.project.foo/bar :cljs my.project.foo/baz)}but an error is thrown

an alternative would be data_readers.cljc content:

{foo/bar my.project.foo/bar}

with my.project.foo/bar implemented with reader conditional:

(defn bar [x]#?(:cljs "cljs!" :clj "clojure!"))

but on reading clojurescript, the clojure branch is executed, for example:

clj --main cljs.main -e "(do (println #foo/bar "2020-02-02"))"

prints 'clojure!!'

I could look into fixing the issue but first need to understand how it ought to work.

Thanks

Environment

None

Activity

Show:
Henry Widd
January 28, 2021, 7:50 AM

Further investigation reveals that it is possible to have reader conditionals in data_readers.cljc in Clojure - the bug is in the Clojurescript side only

Done

Assignee

Henry Widd

Reporter

Henry Widd

Priority

Major