Status on DIP 1040?

Petar Petar
Tue Aug 3 07:53:20 UTC 2021


On Monday, 2 August 2021 at 17:49:56 UTC, Tejas wrote:
> On Monday, 2 August 2021 at 17:37:44 UTC, kinke wrote:
>> On Monday, 2 August 2021 at 17:27:37 UTC, Tejas wrote:
>>> We've been trying to have rvalue references for years now...
>>
>> Who's 'we'? Some people have; I've advocated against them, but 
>> am all in favor of move constructors and assignments.
>>
>
> Didn't Walter(and one more) write the very first 
> proof-of-concept and it got added as 
> ```-preview=rvaluerefparams``` back in April 2019? I assume it 
> was because people DID want them?


`-preview=rvaluerefparams` is a bit different - it is about 
simply allowing rvalues to be passed to `ref` parameters, but it 
doesn't involve adding `T&&` as a type constructor to the type 
system, what I would call real rvalue references. In other words, 
in C++ you can differentiate between an lvalue reference (`T&`) 
and an rvalue one (`T&&`) via function overloading, but in D you 
can't. I think what @kinke is saying is that we don't need the 
whole complexity that `T&&` brings to C++ as we can achieve 95% 
of its usefulness with move constructors and move assignment 
operators.


More information about the Digitalmars-d mailing list