Generality creep

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 28 11:12:11 UTC 2019


On 3/28/19 4:52 AM, Walter Bright wrote:
> A topical example:
> 
> https://github.com/dlang/phobos/pull/6346#issuecomment-477504005

See also the related issue: https://issues.dlang.org/show_bug.cgi?id=18657

Indeed so, thanks. The entire thing with ranges whereby save() does 
something else than a mere copy has been a mistake and supporting it has 
been an expensive distraction.

The intent of save() was as a mere flag to signal that the range is a 
forward range and not an input range. It should have been a simpler 
policy - e.g. ranges that advertise being forward ranges would define 
this inside:

enum bool isForward = true;

Ranges should have one of two categories:

* for input ranges, all copies share and advance the same underlying 
position;

* for forward ranges, each copy holds its own position.

Anything else is not a range.

There's a lot of good stuff in Phobos, and then there's a lot of fat 
added to support an ill-intended notion of generality.


More information about the Digitalmars-d mailing list