On Wednesday, 7 October 2015 at 02:41:12 UTC, Walter Bright wrote:
On 10/6/2015 7:04 PM, bitwise wrote:
On Wednesday, 7 October 2015 at 01:27:27 UTC, Walter Bright wrote:
On 10/4/2015 11:02 AM, bitwise wrote:
For example, streams.

No streams. InputRanges.

This is too vague to really respond to. It does serve as an example of the over-emphasis on ranges in the D community. Ranges are great, but not for
everything.

What can a stream do that a range cannot?

I was trying to make my case for polymorphism, so I haven't thought much about streams specifically, but one obvious thing that stands out is growing on demand.

Stream s = new Stream(4);
s.write(1);
s.write(2); // underlaying buffer grows automatically

I don't see how you would do something like this with a range.

When it comes to an InputRange, I suppose you're right. A BinaryReader could be generalized to read any range.

Again though, if I have to restate what I've been arguing for as simply as possible, it's that I want to use RAII and polymorphism at the same time, as a natural language solution. DIP74 would satisfy everything I'm asking for.

I've detailed my reasoning in this thread already, but structs alone, and structs wrapping classes are not goods solutions.

    Bit


Reply via email to