Someone discussed in WeChat:
cljs.user=> (js* "Symbol('x')")
Cannot convert a Symbol value to a string
Function.cljs.core.str.cljs$core$IFn$_invoke$arity$1 (NO_SOURCE_FILE <embedded>:642:77)
Object.cljs.core.pr_writer_impl (NO_SOURCE_FILE <embedded>:1699:85)
Object.cljs.core.pr_writer (NO_SOURCE_FILE <embedded>:1700:405)
Object.cljs.core.pr_seq_writer (NO_SOURCE_FILE <embedded>:1701:51)
Object.cljs.core.pr_sb_with_opts (NO_SOURCE_FILE <embedded>:1702:156)
Object.cljs.core.pr_str_with_opts (NO_SOURCE_FILE <embedded>:1702:362)
Function.cljs.core.pr_str.cljs$core$IFn$_invoke$arity$variadic (NO_SOURCE_FILE <embedded>:1706:84)
(NO_SOURCE_FILE <embedded>:6231:98)
lumo.pprint.data.LumoPrinter.fipp$visit$IVisitor$visit_unknown$arity$2 (NO_SOURCE_FILE <embedded>:6231:236)
Object.fipp.visit.visit_unknown (NO_SOURCE_FILE <embedded>:5971:111)
Later I got answers from Slack, it should be:
cljs.user=> (js* "Symbol('x').toString()")
"Symbol(x)"
Yes, it’s just missing the
pr-writer
implementation.
And a better solution from rauh is like:
(extend-protocol IPrintWithWriter
js/Symbol
(-pr-writer [sym writer _]
(-write writer (str "\"" (.toString sym) "\""))))
well… ES6…