> On Jul 13, 2019, at 8:21 AM, Jonas Maebe <jo...@freepascal.org> wrote:
> 
> In which scenarios do you need such a custom "move" operator, rather
> than simply allowing the compiler to just copy the data from one place
> to the other without calling a destructor on the old instance?

Not sure off the top of my head what would happen if the user simply wasn’t 
informed about the operation but it makes me nervous. :) It may be the case 
though that inside the move operator the most common thing is just to call 
System.Move anyways. Also if the operator isn’t there then there’s no way to 
know without a modeswitch or some other syntax that the user wants to calls 
system.move instead of the Copy operator.

> 
> I can only imagine this would be a problem if your managed record
> constructor/destructor automatically register/unregister pointers to
> these managed record instances in another datastructure, but is that
> valid in any case?

Hmm, not sure what you mean. If look at the bug report 
(https://bugs.freepascal.org/view.php?id=35825) I did find some bugs relating 
to nested records and fixed them. You can apply the patch or test with 
https://github.com/genericptr/freepascal/tree/moveop

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to