veryDeepCopy

Jim Benson jb at speed.net
Thu Oct 4 17:11:22 UTC 2001


Thanks Tim

Jim

From: "Tim Olson" <tim at jump.net>
>
> Here's something I posted to comp.lang.lisp about Squeak's copying
> methods when this discussion came up there:
>
> ----
>
> The Object class provides a number of default copy operations:
>
> clone
>    make a copy of the object which shares instance variables (shallow)
>
> shallowCopy
>    "public interface" to clone, used to override for things like
> singletons
>
> copy
>    defaults to shallowCopy, general copying method overriden by subclasses
>    as required
>
> copyTwoLevel
>    copy of object with shallow copy of instance variables
>
> deepCopy
>    (recursive) copy of object with deepCopy of all instance variables
>
> veryDeepCopy
>    (probably should really be named "structureCopy" or something)
>    copies the object, using a dictionary to keep track of the mapping from
>    old objects to new objects, so that various identities are preserved
>
> It is up to the various subclasses to override any of these as required,
> or implement a new copying interface.
>
> ----
>
>
>
>
>
>      -- tim
>
>
>
>
>





More information about the Squeak-dev mailing list