clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
p-himik 2019-12-19T15:57:39.002400Z

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.

2019-12-19T16:41:36.003Z

https://clojuredocs.org/clojure.core/keyword has what looks like relevant info

alexmiller 2019-12-19T16:43:15.003900Z

seems very weird to take a keyword as a namespace

alexmiller 2019-12-19T16:43:43.004600Z

so I'd say that seems weird in cljs. surely clj's docstring could be more specific.

p-himik 2019-12-19T16:44:04.005Z

I use it pretty often. Right now with bidi, for example, as IDs of nested routes.

alexmiller 2019-12-19T16:49:25.005900Z

well, that's a cljs invention

p-himik 2019-12-19T16:51:10.006700Z

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.

alexmiller 2019-12-19T16:51:43.006900Z

I don't think there is a general answer

alexmiller 2019-12-19T16:53:00.008400Z

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

alexmiller 2019-12-19T16:54:00.009400Z

I think the best I can say in this particular case is that this is undefined in Clojure and non-portable across dialects

👍 1
2019-12-19T16:59:57.009700Z

i know, but it can give an idea of what others have noted and used