This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-26
Channels
- # aleph (5)
- # announcements (9)
- # beginners (115)
- # boot (36)
- # calva (13)
- # cider (4)
- # clara (7)
- # cljs-dev (27)
- # cljsrn (20)
- # clojure (182)
- # clojure-conj (3)
- # clojure-dev (4)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-nl (4)
- # clojure-uk (34)
- # clojurebridge (3)
- # clojurescript (19)
- # clojureverse-ops (3)
- # core-typed (1)
- # cursive (12)
- # data-science (3)
- # datomic (16)
- # emacs (9)
- # events (5)
- # figwheel-main (11)
- # fulcro (14)
- # graphql (7)
- # jobs (10)
- # jobs-discuss (6)
- # lein-figwheel (8)
- # leiningen (2)
- # lumo (22)
- # mount (1)
- # nrepl (7)
- # off-topic (69)
- # overtone (17)
- # pathom (3)
- # quil (1)
- # re-frame (5)
- # reagent (23)
- # reitit (6)
- # remote-jobs (1)
- # rewrite-clj (4)
- # ring (38)
- # shadow-cljs (54)
- # sql (9)
- # uncomplicate (5)
- # xtdb (1)
should now be on the contributors list
@lee great, just make sure to follow the patch guidelines - when you think you've got in a good spot assign to me or @mfikes
esp. with React dev, it becomes a blocker when e.g. trying to print errors related to React Elements
@lilactown the issue is still open https://dev.clojure.org/jira/browse/CLJS-1628
yeah I've read through the issue and it sounds like there were a number of complications with the original patch. I can't quite tell if it was due to inherent complexity of the problem or due to the way printing / str
worked then (and maybe has changed?)
ah hm.
cljs.user=> (extend-protocol IPrintWithWriter
js/Symbol
(-pr-writer [sym writer _]
(-write writer (str "\"" (.toString sym) "\""))))
#object[Function]
cljs.user=> (str (js/Symbol "foo"))
/Users/r627543/Code/fido/packages/web/app/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/cljs.core.js:10144
return [x].join("");
^
TypeError: Cannot convert a Symbol value to a string
cljs.user=> (js/Symbol "foo")
"Symbol(foo)"
right; it sounds like I'd have to special-case js/Symbol
like the convo on the issue discussed
not really. its just something JS doesn't support so there is no way to fix that part
your extend-protocol
above should make pr-str
work. str
is just never going to work since the engine just doesn't support it.
:thinking_face: I guess I just would expect that (str x)
would coerce x
to string for any x. it works for any CLJS type at least, and most JS types
this has nothing to do with CLJS.
$ node
> [Symbol("foo")].join("")
TypeError: Cannot convert a Symbol value to a string
at Array.join (native)
I don't understand why js Symbol
has such weird semantics regarding toString either but thats what we have ..
that is how CLJS currently implements str
, I understand. and if we take that as the canonical, semantically correct thing to do in all cases then I accept that calling str
on a Symbol should error 😄
@lilactown again .. this is not related to CLJS in any way. this is just JS being weird. "x" + Symbol("foo")
also fails
@lilactown we're not going to provide any hacks around Symbol
Hiya, I think I should be updating https://dev.clojure.org/jira/browse/CLJS-3074 description with my approach, my JIRA is rusty, but I don’t seem to have edit privs? @dnolen
@alexmiller is usually the one handing out edit rights