nextjournal / clerk

⚡️ Moldable Live Programming for Clojure
https://clerk.vision
ISC License
1.74k stars 76 forks source link

Make edn transmission resilient to symbols and keywords with more than one slash #588

Closed mk closed 7 months ago

mk commented 7 months ago

Symbols and keywords with more than one slash like foo/bar/baz can be read by read-string but not in ClojureScript which is based on tools.reader. This changes the roundtrippable? check to read using tools.reader to ensure a symbol will be tagged as a string in case it's not readable, fixing a read exception that could occur when reading in the browser.

This was especially problematic when using cider which overrides the printing of functions so they could be unreadable in the browser:

(pr-str (comp inc dec))
;; => "#function[clojure.core/comp/fn--5892]"