On 5/25/15 10:21 AM, Johannes Pfau wrote:
Am Mon, 25 May 2015 09:40:34 -0700
schrieb Andrei Alexandrescu <seewebsiteforem...@erdani.org>:

On 5/24/15 11:13 PM, Iain Buclaw via Digitalmars-d wrote:
The context here involves concurrency where bar() calls yield and
makes changes to foo before returning to assign the updated results.

We're not addressing that. += is not supposed to do concurrency
magic. -- Andrei

It's not += doing the magic, it's bar(). And it's not limited to
concurrency, it happens with every side effect:

import std.stdio;
void main()
{
     int a = 0;
     int bar()
     {
         a++;
         return a;
     }
     a += bar(); // => a = a + bar()
     writeln(a);
}

DMD: 2
GDC: 1

which one is correct?

GDC. -- Andrei


Reply via email to