On Saturday, 30 October 2021 at 18:31:16 UTC, Andrey Zherikov
wrote:
I did small test and it printed the same values three times so
even rehash doesn't change the address of the value:
So it seems pretty safe to store a pointer to a value in AA.
And I agree that this should definitely be documented.
Address itself may change though. While the AA won't move stuff
around, a GC might. I don't think current GC moves anything, but
it's definitely allowed to. Which would be transparent to your
code so long as you don't depend on the value of address itself :)
https://dlang.org/spec/garbage.html#pointers_and_gc