Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Mon Mar 15 08:08:15 UTC 2021


On 3/13/2021 5:06 AM, deadalnix wrote:
> The whole notion of move assignement is a hack inherited from C++ and don't 
> really make sense for D.

> As soon as you have 2 objects, you are out of the pure move scenario, and you 
> need to deal with this fact. C++ does so by putting the source object in a null 
> state and then destroying it. You cannot have *2* objects and then not destroy 
> one and expect things to not have a ton of edge cases just like postblit for 
> copy does (because you have the exact same problem in reverse there, you had *1* 
> object when you wanted *2*).

The move assignment has access to both objects, and so can "do the right thing".


More information about the Digitalmars-d mailing list