[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object copy function question


Le 06/09/2024 à 14:47, Linus a écrit :
Thank you all for your answer, that confirm there is no magic function already present in Gambas to copy custom Class objects array.

It’s fine, I made mine for the specific Class object array I manipulate into my project.

I just wanted to be sure about the way to do because It took me few hours to find my bug related to the copy of Class object array.

Olivier Cruilles


It's almost impossible to implement a deep copy generic method. Just read the Python documentation about its deep copy method.

Even if you assume a Copy() public method in the object, there are always special cases where you do not want to copy an object, or to copy it only once, etc.

It's better to let the programmer implement it explicitly.

Regards,

--
Benoît Minisini.


References:
Object copy function questionLinus <olivier.cruilles@xxxxxxxx>
Re: Object copy function questionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Object copy function questionBruce Steers <bsteers4@xxxxxxxxx>
Re: Object copy function questionBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Object copy function questionFabien Bodard <gambas.fr@xxxxxxxxx>
Re: Object copy function questionLinus <olivier.cruilles@xxxxxxxx>