std.stream replacement
Jonathan M Davis
jmdavisProg at gmx.com
Fri Mar 8 18:30:30 PST 2013
On Saturday, March 09, 2013 01:59:33 Stewart Gordon wrote:
> On 07/03/2013 12:07, Steven Schveighoffer wrote:
> <snip>
>
> > I don't really understand the need to make ranges into streams.
>
> <snip>
>
> Ask Walter - from what I recall it was his idea to have range-based file
> I/O to replace std.stream.
>
> Thikning about it now, a range-based interface might be good for reading
> files of certain kinds, but isn't suited to general file I/O.
In general, ranges should work just fine for I/O as long as they have an
efficient implementation which underneathbuffers (and preferably makes them
forward ranges). Aside from how its implemented internally, there's no real
difference between operating on a range over a file and any other range. The
trick is making it efficient internally. Doing something like reading a
character at a time from a file every time that popFront is called would be
horrible, but with buffering, it should be just fine. Now, you're not going to
get a random-access range that way, but it should work fine as a forward range,
and std.mmfile will probably give you want you want if an RA range is what you
really need (and that, we have already).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list