More magical AA semantics

monarch_dodra monarchdodra at gmail.com
Sat Jan 12 02:51:59 PST 2013


On Saturday, 12 January 2013 at 04:24:01 UTC, deadalnix wrote:
> On Friday, 11 January 2013 at 13:50:33 UTC, monarch_dodra wrote:
>> I find that with LTR, you end up with a value (T.init), that 
>> you never actually put into your array. IMO, that means 
>> something went wrong somewhere. This is particularly relevant 
>> with "++a[0]".
>>
>
> Not necessarily, as the computation made for an assignation 
> isn't the one made in order to get the value.
>
> It make sense that such expression fail. As long as the AA as 
> the key are computed before the value and in that order.

I guess I can see it either way. My only gripe though is that:
"a[0] = a[0] + 5;"

Could never work if AA's were a "true" library type. I think this 
is a problem, if the plan is to one day completely move AA's out 
of the compiler.

That, and for generic programming, it means my user written 
HashMap! will never be able to have AA's semantics.


More information about the Digitalmars-d mailing list