__rvalue and Move Semantics first draft

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Nov 9 16:15:20 UTC 2024


On 09/11/2024 10:33 PM, Walter Bright wrote:
> https://github.com/WalterBright/documents/ 
> blob/5dbf6728d7d0ae46a411c720ec41e3603310172b/rvalue.md
> 
> I gave up on the previous move DIP. This one is better.

This is a restatement of what I said yesterday at the monthly meeting.

I am significantly happier with this design however:

1. We'll need to introduce a swap builtin, since we have no way to say 
describe moves between parameters. This can come later, as it is an 
addition.
2. I have the concern that existing code that is not designed to accept 
a move, will have a move into it. White listing via an attribute 
``@move`` to say that this constructor/opAssign is designed to handle a 
move in would be valuable.
3. Optimizing of eliding of destructors should be done with type state 
analysis, it does not need its own dedicated DFA.



More information about the dip.development mailing list