Why do associative arrays return from opIndexAssign by value?

TommiT tommitissari at hotmail.com
Thu Jun 20 14:04:31 PDT 2013


On Tuesday, 18 June 2013 at 10:43:58 UTC, Jonathan M Davis wrote:
> On Tuesday, June 18, 2013 12:35:06 TommiT wrote:
>>
>> This must be by design, because associative arrays return 
>> lvalue
>> from += operator as well:
>
> Well, it's also the sort of thing that a lot of people screw up 
> even in C++ -
> they make operater= return void when it should return a 
> reference to the
> object being assigned to. So, it wouldn't entirely surprise me 
> if it's the way
> that it is with AAs, because the person coding them up forgot 
> to do otherwise.
> What's surprises me more is ints, but regardless of whether 
> it's by design by
> not (and there's a decent chance that it is), I'd argue that it 
> was a poor
> decision unless there's something that I'm missing.
>
> In any case, I think that it's worth opening up an enhancement 
> request.
>
> - Jonathan M Davis

I posted an enhancement request just get some kind of an answer 
to this thing:
http://d.puremagic.com/issues/show_bug.cgi?id=10428


More information about the Digitalmars-d mailing list