Why do associative arrays return from opIndexAssign by value?

deadalnix deadalnix at gmail.com
Tue Jun 18 02:26:15 PDT 2013


On Tuesday, 18 June 2013 at 09:18:34 UTC, TommiT wrote:
>> Assignation aren't lvalues in general, so that is consistent.
>
> I didn't see that coming. In C++ assignments are pretty 
> consistently mutable lvalues. Do you know why this is so in D?

I guess because (a = 5) = 7; isn't a really interesting thing to 
do. = is right associative anyway, so most of the time it makes 
absolutely no difference if it is an rvalue or an lvalue.


More information about the Digitalmars-d mailing list