This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-30
Channels
- # announcements (31)
- # aws (17)
- # babashka (26)
- # babashka-sci-dev (8)
- # beginners (16)
- # biff (1)
- # calva (9)
- # cider (5)
- # clj-kondo (3)
- # clj-on-windows (38)
- # cljdoc (2)
- # cljs-dev (9)
- # cljsrn (6)
- # clojure (58)
- # clojure-europe (47)
- # clojure-nl (3)
- # clojure-norway (21)
- # clojure-uk (2)
- # clojurescript (25)
- # conjure (2)
- # data-science (7)
- # datomic (3)
- # emacs (12)
- # events (5)
- # fulcro (5)
- # honeysql (10)
- # introduce-yourself (7)
- # lsp (4)
- # meander (3)
- # nbb (18)
- # off-topic (28)
- # rdf (1)
- # releases (2)
- # sci (5)
- # shadow-cljs (23)
- # sql (5)
- # test-check (3)
The function clojure.edn/read-string
behaves differently in clj vs cljs.
;; in clj
=> (clojure.edn/read-string "#js []")
Execution error at user/eval17 (REPL:1).
No reader function for tag js
;; in cljs
=> (clojure.edn/read-string "#js []")
#js []
why would the clojure variant support the #js
tag? you can make it read properly by providing a handler for it
There is many differences between clj and cljs on reading tags. Both on lisp reader and edn reader
;; clj
user=> #foo 1
Syntax error reading source at (REPL:2:0).
No reader function for tag foo
user=> (ex-data *e)
#:clojure.error{:phase :read-source}
;; cljs
cljs.user=> #foo 1
Syntax error reading source at (REPL:1).
<NO_SOURCE_FILE> [line 1, col 5] No reader function for tag foo.
1
cljs.user=> (ex-data *e)
{:type :reader-exception, :ex-kind :reader-error}
would be welcome a big summary of the differences, that could result in many issues/patches?> I think that by default, the edn/read-string function in cljs should fail too.
...why?
The consistency across languages that are already significantly different is not as important as having built-in platform-friendly functionality. Otherwise, you'd have to remove all js/...
and js-...
stuff either, and a.b
access.
Working on different platforms, in different context.
Vars are also not about the language, it's a concept. And yet, they work differently in CLJ and CLJS.
And JS has no characters, so \C
when read will produce \C
in CLJ but "C"
in CLJS.