[SAoC] Move semantics and STL containers

Suleyman sahmi.soulaimane at gmail.com
Tue Oct 29 21:13:16 UTC 2019


On Tuesday, 29 October 2019 at 15:31:55 UTC, Andrei Alexandrescu 
wrote:
> On 10/23/19 1:19 PM, Suleyman
>> [...]
>
> As far as I understand this is a major language change that 
> proceeded without a known plan, and of which likelihood to be 
> accepted is doubtful.
>
> This work must definitely be coordinated to the other related 
> projects - binding rvalues to ref, move constructors, perfect 
> forwarding, DIP 1014. We can't have different people work 
> independently on their own vision of features that overlap 80%.
>
> Don't we risk adding this to our growing list of projects that 
> people invest vast amounts of talent and work, just to abandon 
> them?

DIP 1014 is postblit based I was advised by Manu to work on a 
constructor based solution for the same reasons that lead to the 
copy constructor being adopted in D.

Prefect forwarding is a combination of auto ref and rvalue ref. 
Razvan told me he was working on perfect forwarding DIP and we 
talked superficially about it.
The implementation of rvalue ref which is required for a perfect 
forwarding solution which doesn't do a copy or move at each level 
is available. There is also `auto @rvalue ref` which exactly does 
perfect forwarding.

Binding rvalues to ref is a separate issue. Even in C++ there is 
rvalue ref and const ref.

The core of move semantics and perfect forwarding has been 
implemented. Whichever syntax is accepted in the end it will be 
just parser work. For example the implementation of the `@move` 
attribute - which is an alternative to rvalue ref just in case 
rvalue ref is not accepted - does actually use the rvalue ref 
implementation underneath, it's only parsed and mangled 
differently.

If I knew of something else related to move semantics that was 
likelier to be accepted I would have included it in this SAOC.

We surely need to collaborate. This work itself is a 
collaboration, I only did the implementation, the ideas are not 
mine. I give credits to all the contributors who shared their 
ideas on the initial discussion thread 
https://forum.dlang.org/thread/oipegxuwqmrmmzefrqcx@forum.dlang.org. We can open a thread somewhere or anybody who is interested can just contact me directly in Slack.


More information about the Digitalmars-d mailing list