assignment: left-to-right or right-to-left evaluation?

Steven Schveighoffer schveiguy at yahoo.com
Mon May 11 08:07:10 PDT 2009


On Mon, 11 May 2009 09:37:56 -0400, Georg Wrede <georg.wrede at iki.fi> wrote:

> Steven Schveighoffer wrote:
>> For example:
>>  mydic[x] = mydic[y] = mydic[z] = mydic.length;
>
>
> I distinctly remember Walter discouraging chained assignments in the  
> doccs, already in the very early versions of D.

Seriously?  So the correct method is to do this:

auto tmp = mydic.length;
mydic[x] = tmp;
mydic[y] = tmp;
mydic[z] = tmp;

???

That sucks.  We have to remember, there are reasons why we stopped having  
to use assembly :)

-Steve



More information about the Digitalmars-d mailing list