[Issue 16674] Clarify lifetime of pointer to AA entry
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Nov 9 04:31:22 PST 2016
https://issues.dlang.org/show_bug.cgi?id=16674
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
IMO:
(In reply to Shachar Shemesh from comment #0)
> The lifetime of aap needs to be clarified. In particular with respect to:
> * Removal of aKey from the aa
This I could go either way. Current code leaves aap as valid. This is what I'd
lean towards. This works great if the data is reference counted. Currently, we
depend on the GC to collect.
> * Removal of another element from the aa
This should not affect aap.
> * Addition of another element to the aa
No effect.
> * Modification of an existing element in the aa with "aa[key] = something"
No effect.
> * Modification of this element in the aa with "aa[aKey] = something".
Should update data that aap points to.
I would say that these proposed rules invalidate many types of hashing schemes,
so we are locked into certain implementation details. But I think that's OK for
"good enough" AA implementation. If you want more control, we should have a
library type for that.
--
More information about the Digitalmars-d-bugs
mailing list