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 clojure.tools.reader.edn.

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

3 Likes

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

1 Like

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

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.