In regards to your question "Why isn't this documented anywhere?", it is
documented somewhere -- in the documentation string for clojure.edn/read,
the very function you were attempting to use:

user=> (doc clojure.edn/read)
-------------------------
clojure.edn/read
([] [stream] [opts stream])
  Reads the next object from stream, which must be an instance of
  java.io.PushbackReader or some derivee.  stream defaults to the
  current value of *in*.

etc.


As far as why it requires a PushbackReader, I didn't design the API.  Yes,
some things in Clojure require using Java interop, and in many (but not
all) cases, file I/O requires it.

Andy

On Sun, Dec 7, 2014 at 8:27 PM, Fluid Dynamics <a2093...@trbvm.com> wrote:

> => (with-open [in (io/reader (io/resource "foo"))] (edn/read in))
> ClassCastException java.io.BufferedReader cannot be cast to
> java.io.PushbackReader  clojure.edn/read (edn.clj:35)
>
> Er, what? Aren't these things supposed to just plug into each other and
> work OOTB? Do I need to muck about with interop to use edn with any input
> source other than strings, then?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to