[Issue 10009] foreach_reverse and AA.byKey/byValue
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Sep 25 09:55:57 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=10009
--- Comment #14 from yebblies <yebblies at gmail.com> ---
(In reply to bearophile_hugs from comment #13)
>
> Associative array pairs have a deterministic but undefined order. So what's
> the reverse of an undefined order?
I'd love for the built-in AAs to use a linked hash map and guarantee iteration
in insertion order... It does have a performance hit on insertion and
deletion, but it is a really nice property for a default AA that isn't
super-optimized for any particular use case.
> A simple solution is to turn
> foreach_reverse on an associative array in a compile-time error.
Yeah, that fits with the error we added for foreach_reverse on a delegate. AAs
are special-cased in the compiler, should be easy enough to special-case an
error for them.
--
More information about the Digitalmars-d-bugs
mailing list