[Issue 10009] foreach_reverse and AA.byKey/byValue
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Sep 25 11:53:04 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=10009
--- Comment #17 from yebblies <yebblies at gmail.com> ---
(In reply to Steven Schveighoffer from comment #16)
> (In reply to hsteoh from comment #12)
> > It *is* possible to implement a reverse traversal in AA's. I'm just not sure
> > it's a good idea (it'd need to allocate memory in order to traverse the
> > linked-lists in reverse order).
>
> Or you could recurse :)
>
> Either way, you need memory.
>
> I think we have two legitimate options:
>
> 1. Fix foreach_reverse .byKey so it does the same thing as foreach
> 2. Make foreach_reverse illegal on all cases of aa.
>
> I lean towards 2.
>
> The goal should be consistency. Making the thing actually work in reverse I
> think is not possible.
2 is absolutely the answer. Basically copy-paste the error from the delegate
foreach_reverse. The check should be the same, just in the Taarray block.
--
More information about the Digitalmars-d-bugs
mailing list