On 18/02/2012 13:22, Daniel Murphy wrote:
"Ben Davis"<[email protected]>  wrote in message
news:[email protected]...
Starting with magic initialisation then...


I meant a different magic initialization:
int[int] aa = null;
aa[3] = 7; // aa is magically not null any more

I've seen some line-blurring between 'null' and 'empty' for dynamic arrays (non-associative). Specifically, I read that array.init returns null for both static and dynamic, but I think I also read that a dynamic array's default value is the empty array. I also observed that null~[1] == [1], and I wondered if actually 'null' becomes an empty array when cast to dynamic array and they're effectively the same thing.

If I'm right, then the same could be true for assoc arrays - that 'null' cast to an assoc array type becomes an empty assoc array. Which would explain the magic you're seeing.

Reply via email to