OutputRange should be infinite?

Steven Schveighoffer schveiguy at yahoo.com
Fri Oct 5 22:12:13 PDT 2012


On Fri, 05 Oct 2012 11:15:44 -0400, monarch_dodra <monarchdodra at gmail.com>  
wrote:

> However, I that the "isOutputRange" definition should require  
> infinite-ness, as mentioned by others.

No, this is very wrong.  A slice is an output range, but is finite.

If you are putting something that is larger into something that is smaller  
and cannot be extended, I would expect an error.  You don't?

This cannot be changed, as the fundamental target for an in-memory output  
range is a slice.

> To enforce infiniteness, I'd like to add this to the requirement of  
> output range:
> *Must meet one of these two criteria:
> **isInifite!Range
> or
> **Does not define "range.empty"
>    //notion of infiniteness by default: delegates etc...
>
> This actually has some very very low impact in phobos: The only  
> OutputRanges ever used by phobos are appenders/delegates/printers  
> anyways.

Just because it isn't *used* by phobos (and I doubt the statement above)  
doesn't mean that it's not a worthwhile part of the API.  Phobos is a  
utility library, not a complete program.

For instance, there is nothing in Phobos that uses  
std.container.RedBlackTree (at least that I know of), but that doesn't  
mean it doesn't have value.

-Steve


More information about the Digitalmars-d mailing list