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

Walter Bright newshound2 at digitalmars.com
Thu Jan 31 22:00:10 UTC 2019

On 1/31/2019 1:46 PM, Andrei Alexandrescu wrote:
> The proposal could actually disallow rvalues that have lvalue syntax, such as 
> "symbol", "symbol[expr]", "symbol.symbol", "symbol.symbol[expr]", etc. Ugh. Gets 
> hairy quickly.

That's why it's problematic to have a rule that rvalues can be implicitly 
converted, but not lvalues. There's not a hard line between lvalues and rvalues. 
For example,

   foreach(i; 0..2)
     int[] a = [1, 2];
     assert(a[0] == 1]);
     a[0] = 3;  // will this cause the assert to fail?

More information about the Digitalmars-d-announce mailing list