Behaviour of AAs after initialization

via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 7 10:38:46 PDT 2014


On Thursday, 7 August 2014 at 16:53:24 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> I'm not the one to make the decision, but I'd vote for 
> codifying this
> behaviour in the language reference. From what I understand, at 
> least,
> it seems that this is the intention anyway, and the current
> implementation certainly suggests so. Otherwise, it leads to 
> strange
> awkward semantics where passing AA's around may sometimes 
> change the
> original "view" of it, and sometimes not.

I agree, we already have this behaviour with regular arrays, 
that's why Dragos thought AA act the same. But for arrays it is 
out of necessity, because slice store (and expose in the API!) a 
pointer to the data, while AAs can afford to act differently, 
because their implementation is opaque.


More information about the Digitalmars-d mailing list