front stability

Mathias Lang via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 30 08:56:43 PDT 2016


2016-06-02 14:51 GMT+02:00 Steven Schveighoffer via Digitalmars-d <
digitalmars-d at puremagic.com>:

> I have always treated ranges with this expectation:
>
>
I think the case is pretty clear here, and I'm in agreement with you.

I just want to add a note on the following point:
2016-06-02 14:51 GMT+02:00 Steven Schveighoffer via Digitalmars-d <
digitalmars-d at puremagic.com>:

> The counter-argument seems to be that if you cache the front element, then
> then making a copy of the range via take can repeat the cached element[4].
> I find this argument severely lacking -- non-forward ranges are not meant
> to be copied and expected to operate properly, it's why we require calling
> save.
>

The compiler is blatantly guilty of doing so:
https://issues.dlang.org/show_bug.cgi?id=15413
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20160630/7ef71013/attachment.html>


More information about the Digitalmars-d mailing list