[fpc-devel] Move operator
Ryan Joseph
genericptr at gmail.com
Sun Jul 14 16:19:56 CEST 2019
> On Jul 14, 2019, at 8:55 AM, Jonas Maebe <jonas at freepascal.org> wrote:
>
> The question then still remains: why would a user want to call a copy
> operator when the data is just moved from a temp to another place?
> Having an explicit copy operator when there is no use case for it only
> requires programmers to write extra code that can contain bugs.
Your point is well taken but I really don’t have any better answer than it doesn’t feel balanced with the copy operator in that same level of control to the user. Using the management operators it feels like your opting into having the compiler tell you when it’s performing certain operations on the record so it feels wrong that the move operation is happening without telling you. Just my feelings though. :)
Do you have another proposal then? If there’s no move operator then there’s no way to signal that a move is going to override the usual copy operator call which happens every time. I guess the only other viable option would be a modeswitch or some other compiler directive to toggle on/off.
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list