I've been looking over our use of contrib in our large-ish project
at work. About 90% of the invocations of contrib functions are
I/O-related. I wonder if it would be a good idea to include a clojure.io
namespace in Clojure itself. I've mentioned the idea a few times on IRC,
and people seemed to be very much in favour.

I've prototyped this in the attached file. Most of the functions come
from contrib's duck-streams library. I've taken everything from
duck-streams except read-lines, file-str, make-parents, and pwd.

read-lines was left out since using it will quite often result in a
leak; closing resources inside a lazy-seq is almost always
problematic. with-in-reader should be used instead. file-str was omitted
because file from java-utils is much nicer. make-parents was omitted in
favour of a new more general function, mkdir. pwd was omitted because
the JVM doesn't have a notion of a "working directory" as most
environments do. But it could be moved to contrib's java-utils if people
are fond of it.

I've also taken the file, delete-file, and delete-file-recursively
functions from java-utils. I've added support for treating ~ as $HOME to
file since that was present in duck-streams' file-str function. delete-file
and delete-file-recursively are especially necessary if you ever write
tests for functions that create files. relative-path-string and as-file
were also taken from java-utils simply because they are used for the
file function.

I welcome discussion about this proposal. Do you think it's necessary? Are
there any functions we should leave out? Any others we should promote from
contrib?

-Phil

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

Attachment: io.clj
Description: Binary data

Reply via email to