This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-19
Channels
- # adventofcode (18)
- # announcements (1)
- # babashka (153)
- # beginners (73)
- # bristol-clojurians (4)
- # calva (1)
- # cider (6)
- # clj-kondo (38)
- # clojure (154)
- # clojure-dev (12)
- # clojure-europe (7)
- # clojure-finland (11)
- # clojure-nl (70)
- # clojure-spec (13)
- # clojure-uk (101)
- # clojuredesign-podcast (2)
- # clojurescript (15)
- # core-async (30)
- # cryogen (1)
- # cursive (5)
- # devops (1)
- # duct (4)
- # figwheel-main (1)
- # fulcro (19)
- # jobs (12)
- # kaocha (17)
- # luminus (2)
- # malli (8)
- # music (5)
- # nrepl (13)
- # off-topic (20)
- # overtone (3)
- # re-frame (7)
- # reagent (38)
- # shadow-cljs (13)
- # specter (3)
- # tools-deps (6)
- # vim (7)
There's a discrepancy in keyword
behavior between Clojure and ClojureScript:
cljs.user=> (keyword :a :b)
:a/b
clj.user=> (keyword :a :b)
Execution error (ClassCastException) at dev/eval103787 (form-init191682565753033842.clj:1).
class clojure.lang.Keyword cannot be cast to class java.lang.String (clojure.lang.Keyword is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
Given that providing keywords for both ns
and name
arguments is explicitly handled in ClojureScript, I assume that it's an issue on Clojure's side. Especially since the docstrings don't say anything about argument types.https://clojuredocs.org/clojure.core/keyword has what looks like relevant info
seems very weird to take a keyword as a namespace
so I'd say that seems weird in cljs. surely clj's docstring could be more specific.
well, that's a cljs invention
How are such things handled in general? Are they just left to be? Since changing the behavior of CLJS in this case would be backward incompatible.
I don't think there is a general answer
offhand, I can think of cases where clj does things cljs doesn't, the opposite of that, and even cases where they are incompatible in some ways
this is not canonical documentation
I think the best I can say in this particular case is that this is undefined in Clojure and non-portable across dialects