Status on DIP 1040?

Tejas notrealemail at gmail.com
Tue Aug 3 08:29:15 UTC 2021


On Tuesday, 3 August 2021 at 07:53:20 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Monday, 2 August 2021 at 17:49:56 UTC, Tejas wrote:
>> [...]
>
>
> `-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.

I know they're not real(see my original post's 2nd last 
sentence), but I was working out how to transpile C++ and without 
being able to represent rvalue refs, it's going to be impossible.
How can you hope to accurately represent ```t&&``` without rvalue 
refs?

How will I accurately transpile
```
auto func(t)
auto func(t&)
auto func(t&&)
```
set of overloads without rvalue refs?
I could play around with ```typedef```s and somehow 
manage(perhaps), but it would be a lie and hurt performance 
non-trivially.


More information about the Digitalmars-d mailing list