Generality creep

ag0aep6g anonymous at example.com
Thu Mar 28 11:45:49 UTC 2019


On 28.03.19 12:12, Andrei Alexandrescu wrote:
> 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.

`save` is a red herring with regards to issue 18657.

The problem isn't RefRange.save, it's RefRange.opAssign. The issue 
manifests often in implementations of `save`, but that's just because 
they *assign* the result of `save` over an existing range.

Note that there's no `save` call in issue 18657's third example (`choose`).

The question is whether ranges are allowed to implement opAssign like 
RefRange does. If so, all of Phobos needs fixing to avoid calling 
opAssign. If not, RefRange.opAssign should be removed.


More information about the Digitalmars-d mailing list