std.stream replacement

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 8 18:13:36 PST 2013


On Fri, 08 Mar 2013 20:59:33 -0500, Stewart Gordon <smjg_1998 at yahoo.com>  
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.

I hope to convince Walter the error of his ways :)

The problem with this idea, is that there isn't a proven design.  All  
designs I've seen that involve ranges don't look attractive, and end up  
looking like streams with an awkward range API tacked on.  I could be  
wrong, there could be that really great range API that nobody has  
suggested yet.  But from what I can tell, the desire to have ranges be  
streams is based on having all these methods that work with ranges,  
wouldn't it be cool if you could do that with streams too.

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

I think a range interface works great as a high level mechanism.  Like a  
range for xml parsing, front could be the current element, popFront could  
give you the next, etc.  I think with the design I have, it can be done  
with minimal buffering, and without double-buffering.

But I see no need to use a range to feed the range data from a file.

-Steve


More information about the Digitalmars-d mailing list