Associative array
bachmeier
no at spam.net
Sun Oct 15 02:53:24 UTC 2023
On Sunday, 15 October 2023 at 00:14:39 UTC, Jonathan M Davis
wrote:
> My main concern here would be that we not add calls which
> relate to how AAs are currently implemented but which may not
> relate to how they're implemented in the future if/when we make
> changes, and I'm inclined to think that anything to do with
> buckets is an implementation detail, making reserving not
> something that users should really be doing. It _might_ make
> sense to have a general reserve function that says that you're
> planning to insert X number of elements, allowing the AA to
> pre-allocate some stuff based on that information, but I don't
> know how much sense that really makes given that what that
> would mean for a given AA implementation could differ quite a
> bit.
>
> If rehashing is what you want, we already have that:
>
> https://dlang.org/spec/hash-map.html#properties
>
> Ultimately though, I think that we want to be careful about how
> much we expose of the AA, since that's going to restrict what
> we can do to improve it in the future, and if someone wants to
> do much a tweaking, IMHO, a user-defined type would make more
> sense than the language-provided AAs.
>
> Steven would likely have a much better idea of how much sense
> this idea makes given that he's been working on the AA stuff
> and is familiar with some of the changes that have been made to
> it over time.
>
> - Jonathan M Davis
Someone wanting to work on this could build on the EMSI hashmap:
https://github.com/dlang-community/containers/blob/master/src/containers/hashmap.d That would leave it as a library solution rather than messing with the AAs in the language.
More information about the Digitalmars-d
mailing list