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

Steven Schveighoffer schveiguy at gmail.com
Thu Jan 31 21:50:32 UTC 2019

On 1/31/19 4:46 PM, Olivier FAURE wrote:
> On Thursday, 31 January 2019 at 18:31:22 UTC, Steven Schveighoffer wrote:
>> BTW, the DIP discusses how to annotate these rare situations:
>> int doubleMyValue(ref int x) { ... }
>> @disable int doubleMyValue(int x);
> I don't think that's a solution. The problem is in the getter method, 
> not in doubleMyValue. If nothing else, since the DIP is designed to work 
> on existing functions, it could happen on doubleMyValue functions which 
> would be both designed by and used by people completely unaware of 
> DIP-1016.

How is the problem not in doubleMyValue? It's sole purpose is to update 
an lvalue. It is the perfect candidate to mark with @disable for rvalues.


More information about the Digitalmars-d-announce mailing list