DIP 1016--ref T accepts r-values--Formal Assessment

kinke noone at nowhere.com
Thu Jan 24 22:13:20 UTC 2019


On Thursday, 24 January 2019 at 21:57:57 UTC, Rubn wrote:
> it could be an error if the function didn't assign the variable 
> a value instead

I don't like that, conditional mutations like this should work 
too:

void conditionalIncrement(bool condition, out long value) {
   if (condition)
     ++value;
}

conditionalIncrement(true, 10); // not allowed, rvalue

long value = 10;
conditionalIncrement(true, out value); // fine


More information about the Digitalmars-d-announce mailing list