> On Jun 17, 2019, at 1:00 PM, Sven Barth via fpc-devel > <fpc-devel@lists.freepascal.org> wrote: > > If we do this at all we should use a separate operator as those two are > rather different operations and the compiler would already have figured out > which of the two operations is needed and thus the code inside the operator > doesn't need to do that anymore. > > That said this would require extending the RTL assignment helper. > > And the problems that Jonas mentioned are less problems inside the compiler, > but problems inside the user code when they write their Move operator > incorrectly. From great power comes great responsibility after all and I'm > not sure whether we should provide the users with that much power.
I see. Looking at this on Sunday I see in assignment nodes fpc_copy_proc would need to be modified or a new fpc_move_proc introduced which (for now at least) would only affect records which had a move operator. In theory the concept could be extended to dynamic arrays and other reference counted types but that’s another story. Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel