More magical AA semantics

monarch_dodra monarchdodra at gmail.com
Sat Jan 12 04:30:47 PST 2013


On Saturday, 12 January 2013 at 12:05:30 UTC, Jonathan M Davis 
wrote:
> On Saturday, January 12, 2013 11:51:59 monarch_dodra wrote:
>> 
>> 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.
>
> But that should result in a RangeError. It's not something 
> that's supposed to
> work. It's a bug. So, the fact that a library type couldn't 
> duplicate it is
> irrelevant. The fact that it can't have a particular bug isn't 
> exactly a
> problem.
>
> - Jonathan M Davis

Oh... Right...

I guess I missread this thread (and 9rnsr's pull), and was lead 
to understand that we were going the road of accepting this.

Well, my bad than.

What about "++a[0]" when there is no a[0]? Is this something that 
will throw or not?

As well, what about
//----
immutable(int)[int] aa;
aa[0] = 5;
//----
This should work, right?


More information about the Digitalmars-d mailing list