[Issue 10009] foreach_reverse and AA.byKey/byValue

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 25 11:04:54 PDT 2014


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

--- Comment #16 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(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.

--


More information about the Digitalmars-d-bugs mailing list