[phobos] Fwd: [Issue 4025] New: Making network with the std.stdio.File interface
Andrei Alexandrescu
andrei at erdani.com
Wed Apr 7 18:56:23 PDT 2010
On 04/07/2010 04:09 AM, Lars Tandle Kyllingstad wrote:
> Sorry, I totally forgot to answer this one. I don't know if I've earned
> the right to vote here yet, but if so I vote 'yes'. (Or was it 'yarrrr'?)
>
> Regarding the use of std.stdio.File: Though I agree with Steve that a
> native D solution for buffered IO would be way better than relying on
> FILE*, I really like the *interface* of File. (In particular, I like the
> byLine and byChunk ranges.)
>
> And that's really all we need to worry about at the moment -- find a
> good interface now, improve the implementation later. A good interface
> should be as implementation independent as possible, so there will be
> minimal breakage to user code later.
Agreed.
BTW File will receive a couple more ranges: byDchar which spans the file
one dchar at a time, byWchar which is sometimes necessary due to the
awkward fwide API (see
http://www.opengroup.org/onlinepubs/007908775/xsh/fwide.html), and
byChar for getting one narrow character at a time. (Or should that be
byUbyte or something?)
As I mentioned in another email, these are implementable with good
efficiency using nonstandard APIs. Otherwise each iteration will cost
one call to fgetc and one call to fungetc.
Andrei
More information about the phobos
mailing list