buffered input

Steven Schveighoffer schveiguy at yahoo.com
Mon Feb 7 04:53:50 PST 2011


On Sat, 05 Feb 2011 00:46:40 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> I've had the opportunity today to put some solid hours of thinking into  
> the relationship (better said the relatedness) of what would be called  
> "buffered streams" and ranges. They have some commonalities and some  
> differences, but it's been difficult to capture them. I think now I have  
> a clear view, caused by a few recent discussions. One was the CSV reader  
> discussed on the Phobos list; another was the discussion on defining the  
> "right" std.xml.

[snip]

> What do you all think?

I haven't read many of the responses, but I'll say again what I've always  
said.  The range concept does not fit streams very well.  I think a range  
can be built on a stream, but I think a buffered stream should be it's own  
type (similar to how you laid it out a few weeks ago).

IMO, a stream should be a simple class hierarchy that defines input/output  
and buffering.  Then ranges can be built on top of the stream to interface  
with other parts of phobos.

Now, I think as an *input parameter* for algorithms that wish to work with  
streams (or other ranges), a range of T[] is most appropriate.

-Steve


More information about the Digitalmars-d mailing list