[phobos] UnbufferedFile, or, abstracting the File ranges

Denis 2korden at gmail.com
Mon May 10 05:43:39 PDT 2010


On Mon, May 10, 2010 at 3:40 PM, Lars Tandle Kyllingstad
<lars at kyllingen.net> wrote:
> In the process of designing std.process it has become obvious, as
> pointed out by Steve, that Phobos needs facilities for unbuffered I/O.
> To that end, I've started writing an UnbufferedFile type, the current
> status of which can be seen here:
>
>        Code: http://github.com/kyllingstad/ltk/blob/master/ltk/stdio.d
>        Docs: http://kyllingen.net/code/ltk/doc/stdio.html
>
> (Disclaimer: This is very much a work-in-progress, there's lots of stuff
> that needs to be added yet, and I'd be surprised if there wasn't lots of
> room for improvement, performance-wise.)
>
>
> Now, while writing this it has kind of annoyed me that I have to write
> new implementations of the byLine and byChunk ranges.  I've personally
> found them incredibly useful, so I want them in UnbufferedFile, but the
> ones in std.stdio are tailored for File.
>
> I therefore suggest we try to abstract these ranges, so they can operate
> on general types that define a set of primitives such as read(), readc()
> and readln().
>
> Are there problems with this?  Any comments?
>
> -Lars
>

A little bit of a bike-shed and an off-topic discussion, by I think
it's time to drop the C-style "r", "b", "w+" archaism in favor of type
safe enums. It might be better to also cover access rights - what
access is available to the file while it is being used by our process
(read, write, remove etc).


More information about the phobos mailing list