[Issue 13936] groupBy must be redone

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 8 17:01:14 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13936

--- Comment #12 from hsteoh at quickfur.ath.cx ---
I don't see what's the big problem with supporting non-equivalence relations,
all it means is that you have to evaluate the predicate only between adjacent
elements rather than between an element and the head of its subrange (which was
what was done in the initial implementation). But whatever, I don't actually
have any current code that relies on groupBy supporting non-equivalence
relations, so I don't really care. I just don't understand why this has
suddenly become such a major issue.

By "it's complicated" I do not mean "it's complicated to write code for" --
that's a non-issue. What I mean is "it introduces complicated semantics, which
inevitably results in obscure corner cases that have unexpected/pathological
behaviour". This includes effects of similar calibre as transient ranges (they
technically conform 100% to the range API but have unusual behaviour that
cannot be easily dealt with). One such effect is the semantics of .save.

The compiler bugs bit, I admit, is a bit a of red herring, though. :-P

Don't forget that random-access ranges are still forward ranges, so you still
have to deal with the semantics of .save.

And I wasn't trying to find reasons it can't be done; I was just pointing out
obvious flaws in your proposed solution that would introduce more problems than
it solves.

--


More information about the Digitalmars-d-bugs mailing list