AAs are (like regular dynamic arrays) initialized to `null`. On first modification (i.e. assignment of an element), memory is allocated and the AA variable updated to point at it.

However, is there a guarantee that AAs are never reallocated once they are initialized, i.e. is it then safe to assume that changes made through a copy of an AA variable (e.g. pass by value) are visible through the original variable?

The current implementation behaves like this, but the language reference does not mention it, AFAICS. I'd like to amend the documentation if this behaviour is reliable.

This is the thread where the question came up:
http://forum.dlang.org/post/qnllglkrrgfdpwbmv...@forum.dlang.org
http://forum.dlang.org/post/tguaxwqijnkqszgha...@forum.dlang.org

Reply via email to