Clojure.core/read-string not for reading EDN, then what?


Continuing the discussion from Which piece of code do you think makes ClojureScript significant?:

And what should I use in ClojureScript?


It is fine to use clojure.core/read-string if you read only trusted data. It has a few extra reader features which make it potentially insecure (eg. the #= eval reader macro). The default was changed to off in Clojure 1.4 I think so it is reasonably safe to use nowadays though.

For EDN a dedicated reader was added in the clojure.edn namespace. tools.reader also offers

ClojureScript has cljs.reader which was removed recently and replaced to use tools.reader implementation instead. So using either the cljs.reader or namespace is basically the same.


Can’t image cljs.reader was removed. Not even noticed. ╮(╯_╰)╭


Well the namespace is still around. The implementation was just removed and now uses tools.reader.