Re: ordered string-list considered harmful, was Re: [PATCH v3] Allow aliases that include other aliases
From: brian m. carlson <hidden>
Date: 2018-09-08 16:49:16
Attachments
- signature.asc [application/pgp-signature] 868 bytes
From: brian m. carlson <hidden>
Date: 2018-09-08 16:49:16
On Fri, Sep 07, 2018 at 12:23:53AM -0700, Jonathan Nieder wrote:
Ævar Arnfjörð Bjarmason wrote:quoted
If this turns out to be a common use-case perhaps the easiest way to support that would be to make the hashmap (optionally?) ordered, as Ruby 1.9 did with their hash implementation: https://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/That's about recording the order of insertion. I'm talking about something much simpler: sorting an array (as preparation for emitting it) and binary searching to find an entry in that array.
If you want both a collection that is always sorted and has efficient lookup for an arbitrary entry, then a B-tree is probably a better choice. That's the primitive that Rust provides for that situation. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204