News for hackers. Stuff that matters.
Re:Clojure's Default Reader is Unsafe by stonemetal on Friday March 08, 2013 @11:24AM (#5344205)
Not really, read-line is more or less equivalent to python's input method. It reads raw input and tries to evaluate it. Passing false makes it safer for reading data structures, but it will still try to execute Java constructors so that your data is correctly initialized. To be safe you need to use other methods i.e. edn(extensible data notation).

edn limits what is allowed to a safe subset of what read-line will allow, all of the base clojure types and collection types (maps, lists, sets, vectors) are allowed, Java isn't.

Re:Clojure's Default Reader is Unsafe by mjw on Friday March 08, 2013 @05:18PM (#5346108)
> It reads raw input and tries to evaluate it

Not quite. It reads raw input and tries to build a syntax tree from it. Unfortunately reader macros in clojure allow all sorts of objects to form part of said syntax tree and arbitrary-ish code to run at parse time to instantiate them. But the main job of the reader isn't to evaluate code.