DIP 1040
Timon Gehr
timon.gehr at gmx.ch
Thu Jul 18 20:41:06 UTC 2024
On 7/18/24 22:27, Walter Bright wrote:
> On 7/14/2024 3:51 AM, Timon Gehr wrote:
>> - a parameter storage class that enforces the parameter was moved.
>
> The caller should make the decision of whether it's a move or a copy,
> the callee should not care. The callee owns the value (and hence must
> destruct it) in either case.
>
It's simply that often, move is a better default than copy. This is
because copies are silent, while use after move will give a diagnostic,
forcing an explicit, and visible, opt into the less efficient semantics.
Perhaps being able to change the default at the type level might be
sufficient. I guess it can kind of be achieved with a private copy
constructor.
More information about the Digitalmars-d
mailing list