Can the order in associative array change when keys are not midified?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 1 22:20:50 PST 2015


On Thursday, 1 January 2015 at 18:58:04 UTC, Andrej Mitrovic via 
Digitalmars-d-learn wrote:
> On 1/1/15, Tobias Pankrath via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>> You could implement an OrderedMap!(Key, Value) via
>> RedBlackTree!(Tuple!(Key, Value), (a,b) => a[0] < b[0]).
>
> We could add this as an alias into Phobos or perhaps as just a
> documentation line on the website.

V good point.

This is one of those small frictions that cumulatively raises the 
cost of adoption for newcomers who are not by nature hackers but 
want to get stuff done, and yet could be valuable members of the 
D community over time.  For whatever reason, there is some 
resistance for many people to ask for help in a forum and it is 
easy to be overwhelmed and give up.  Modern people don't have 
much tolerance for pain, even though that's an essential part of 
learning and being a developer.   And compare python where you 
have OrderedDict and a search will find many examples of how to 
use it.

I agree with comments about readability of library functions, but 
maybe also worth extending hints and tips for common patterns / 
code fragments.

What is the protocol for contributing to the wiki?  Can one just 
edit it ?


More information about the Digitalmars-d-learn mailing list