Does associative array change the location of values?
Steven Schveighoffer
schveiguy at gmail.com
Sat Oct 30 16:55:03 UTC 2021
On 10/30/21 10:51 AM, Stanislav Blinov wrote:
> On Saturday, 30 October 2021 at 11:59:15 UTC, Steven Schveighoffer wrote:
>
>> It should be documented. There isn't a valid way to remove these
>> requirements, even if they are currently just an implementation detail
>> -- code already depends on these properties.
>
>> And D is a GC-based language, especially when using AAs. There is no
>> reason to introduce undefined behavior for existing usage.
>
> You won't introduce UB by deallocating unreferenced elements, which a
> given GC *may* be able to figure out. Therefore I object to "AAs do not
> deallocate the key/value pairs ever" part. Strongly :) Until such time
> that such a requirement is indeed set in stone, and not incidental.
auto v = k in aa;
aa.remove(k);
How can the GC/compiler work out that there is still a reference?
-Steve
More information about the Digitalmars-d-learn
mailing list