Thread overview
[Issue 18807] RefRange behaves very differently for Input Ranges and Forward Ranges
Apr 30, 2018
ag0aep6g
Apr 30, 2018
Eyal
Apr 30, 2018
Eyal
Dec 17, 2022
Iain Buclaw
April 30, 2018
https://issues.dlang.org/show_bug.cgi?id=18807

ag0aep6g <ag0aep6g@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=14619

--- Comment #1 from ag0aep6g <ag0aep6g@gmail.com> ---
Possibly a duplicate of issue 14619.

--
April 30, 2018
https://issues.dlang.org/show_bug.cgi?id=18807

--- Comment #2 from Eyal <eyal@weka.io> ---
It's related -- but that issue is about "foreach" behavior, and this issue is about RefRange behavior, which probably should not define opSlice (as mentioned in passing in issue 14619).

--
April 30, 2018
https://issues.dlang.org/show_bug.cgi?id=18807

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com

--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> ---
There are 2 issues here. One is the same from 14619 -- the compiler is assuming opSlice  on a valid range is a no-op.

The second issue is that for some reason opSlice is defined in RefRange iff save is defined. That makes no sense.

Fixing either of these issues will fix the problem I think.

--
April 30, 2018
https://issues.dlang.org/show_bug.cgi?id=18807

--- Comment #4 from Eyal <eyal@weka.io> ---
Indeed, and both are worth fixing.

So I think it makes sense to keep these 2 issues:

issue 14619 should fix compiler's foreach behavior (calling opSlice
unnecessarily)

this issue should fix RefRange in phobos, to avoid defining opSlice().

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18807

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

--