Discussion: Rvalue refs and a Move construtor for D

Manu turkeyman at gmail.com
Wed Sep 4 18:32:54 UTC 2019

Wed, Sep 4, 2019 at 2:25 AM kinke via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Wednesday, 4 September 2019 at 00:33:06 UTC, Exil wrote:
> > How would it work with multi-function passing though? With a
> > rvalue reference, you are effectively just passing around a
> > reference, until the contents of the value are moved. So you
> > can pass it through N functions and it won't ever to do a
> > move/copy.
> >
> > Would you effectively be relying on the compiler to optimize
> > out the un-necessary moves, or would they be unavoidable, as
> > they effectively are now?
> Yes, by changing the ABI details to the C++ way in this regard,
> making move/forward intrinsics and detecting them in argument
> expressions. Laid out earlier in this thread in
> https://forum.dlang.org/post/jogsaeqxouxaeflmgzcc@forum.dlang.org. We don't need rvalue refs in the language for that at all, just use a value parameter - rvalue args will be passed by ref under the hood, just like explicitly moved lvalue args.

rvalue ref could be implicit, but it still need to be attributed on
the argument... isn't that what's being resisted here?

More information about the Digitalmars-d mailing list