-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
While working on #13002 I had this weird idea that I want to share. It is possible that we don't need =sink operator at all. It doesn't mean we will not move objects. I suggest we will replace =sink with the combination of the following three operations:
=destroy(dest) # avoidable if we can prove that it is first assignment to dest
memCopy(dest, source)
wasMoved(source) # avoidable if we can prove that source can't be double freedTherefore =sink will always mean bitwise shallow copy. In old days sink operator contained an if statement that checked if it is self assignment. It is now gone it is done outside. Compiler also takes the liberty of replacing =sink calls with bitwise copy when it likes it. Possibly we can just simplify the stack and do bitwise copy in all cases.
It is easy to prove that I am wrong just provide one counter example that will not work without =sink operator.