Thread overview
[Issue 23422] uniq backward iteration has different elements to forward iteration
Oct 17, 2022
FeepingCreature
Oct 17, 2022
FeepingCreature
Oct 17, 2022
Mario Kroeplin
Oct 17, 2022
Dlang Bot
Dec 17, 2022
Iain Buclaw
October 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23422

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|uniq loses position when    |uniq backward iteration has
                   |chained to joiner           |different elements to
                   |                            |forward iteration

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

--- Comment #1 from FeepingCreature <default_357-line@yahoo.de> ---
Update: The actual issue is that uniq backwards iteration contains different elements than its forwards iteration:

import std;

void main() {
    auto range = [1, 2].uniq!"true";
    writefln!"forward %s, backward %s"(range.retro.array.retro.array,
range.array);
    assert(range.retro.array.retro.array == range.array);
}

I understand why uniq would want to work that way, but it should arguably not be allowed to: https://dlang.org/library/std/range/primitives/is_bidirectional_range.html says that `back` has to return "the last element in the range". It's undefined what exactly this means, but it's certainly questionable that "back" is an element that doesn't appear in the forward iteration order at all.

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

Mario Kroeplin <kroeplin.d@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
                 CC|                            |kroeplin.d@googlemail.com

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

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@FeepingCreature created dlang/phobos pull request #8610 "Fix issue 23422: Disable uniq backwards iteration if a predicate is passed." fixing this issue:

- Fix issue 23422: Disable uniq backwards iteration if a predicate is passed.

https://github.com/dlang/phobos/pull/8610

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=23422

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10505

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--