[phobos] UnbufferedFile, or, abstracting the File ranges

Andrei Alexandrescu andrei at erdani.com
Tue May 11 11:20:38 PDT 2010


Lars Tandle Kyllingstad wrote:
> On Mon, 2010-05-10 at 16:43 +0400, Denis wrote:
>> 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:
>>>
>>> [...]
>> 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).
> 
> 
> Actually, I was planning to do just that -- the enum thing, that is.
> But I did a little investigation, and found that the file mode is
> specified with a string in Python too, and I thought:  If C and Python
> actually agrees about something, who am I to argue? :)

I had that question to solve when working on std.stdio.File and took the 
path of least resistance. Now that we want to make File work with more 
general files, perhaps we could complement the string-style flags with 
an enum.

Andrei



More information about the phobos mailing list