Ranges with length that cannot be named

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Wed Sep 25 17:03:07 UTC 2019


On 9/18/19 3:10 PM, berni wrote:
> We are used to divide ranges in two: Ranges with length and infinite ranges.

This is incorrect - there are plenty of ranges with finite length that 
is, however, not known in O(1), such as the result of filter. The 
isInfinite trait describes ranges that are statically known to be 
infinite, and has turned out to be of moderate value.

Also, there's a more productive view - instead of a classification of 
ranges, think of "length" as an optional attribute of a range.

(This is related to the concepts vs. DbI debate. Concepts: "We define 
the RangeWithLength and RangeWithoutLength concept, have at it." DbI: "A 
range may or may not have length, I'll go about things accordingly.")`


More information about the Digitalmars-d mailing list