Duck-streams does good job supporting character based readers and
writers, but doesn't do such a complete job with byte-oriented I/O
using InputStream and OutputStream. (The to-byte-array and copy
mutli-methods offer some support, but there's no equivalent to the
reader and writer multi-methods.)

It occurs to me that we could refactor most of reader into an
input-stream multi-method, which could be useful on its own for
byte-oriented I/O.
The same is true of writer and output-stream.

Also, reader and writer produce streams which are buffered, but accept
what the JDK defines as default instead of using *buffer-size*.
Perhaps that should be changed.

input-stream and output-stream should, presumably also produce
buffered streams (perhaps only when (< 0 *buffer-size*).

Has anyone already begun work on similar changes? I'd be interested in
feedback. Perhaps byte-oriented I/O was left out of duck-streams
intentionally. In the meantime, I've begun hacking on some private
branches of clojure-contrib to explore these ideas. I'll put something
up on github if my musings reach a usable state.

In a library of my own, I've used stream decorator functions as below
to accomplish what hardcoding BufferedReader. into the reader methods
does:

(-> x input-stream reader buffered)

This has a nice feel of orthogonality, but I hesitate to incorporate
this idea it duck-streams because I'm doubtful that this approach
would gel stylistically with the rest of duck-streams. Thoughts?

// ben

-- 
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

Reply via email to