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

Re: Object copy function question


You can speed up the copy by mixing the array.copy and self made copy for
referenced types (object or arrays)

But remember that each object must have a self copy function because there
is no way to make it automatically in all cases


Le ven. 6 sept. 2024 à 00:54, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> a écrit :

> Le 06/09/2024 à 00:13, Bruce Steers a écrit :
> > A method like CopyData or CopyNew or CopyContents or some other relevant
> > word that copies an array contents as an actual copy without referencing
> > would be awesome.
> > The Word Copy kinda misleads to think  you will get a true copy of the
> > data instead of references. I've had to recursively copy arrays within
> > arrays in some code to overcome the referencing.
> > Just a thought 😊
> >
>
> There is no "false" or "true" copy method, but "shallow" and "deep" copy.
>
> You can't have a deep copy method of an array (or collection) contents
> in Gambas, as there is no standard way for the interpreter to know how
> to copy an object.
>
> Regards,
>
> --
> Benoît Minisini.
>
>
>

-- 
Fabien Bodard

Follow-Ups:
Re: Object copy function questionLinus <olivier.cruilles@xxxxxxxx>
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>