[BUG][FIX] Very deep copy aid
Ted Kaehler
Ted at SqueakLand.org
Wed May 14 03:07:12 UTC 2003
Object>>veryDeepCopyUsing: is a utility method. When you have a
complex data structure, involving several custom classes,
veryDeepCopy on a subpart may not do what you want. When you
veryDeepCopy one of your objects, it does not know which instance
variable are actually pointers back to a 'global' object, which
should not be duplicated. The 'parent' links in a tree are an
example. These can be handled by creating veryDeepInner: and
veryDeepFixupWith:. However, it may be easier to make a custom
veryDeepCopy method. In it, you create a DeepCopier, and store into
its references dictionary with (globalObject -> globalObject). Then
you want to start a veryDeepCopy using that DeepCopier, and calling
veryDeepCopyUsing: is the way to do that.
Change Set: VeryDeepCopyU-tk
Date: 13 May 2003
Author: Ted Kaehler
(Tested in a standard 3.6alpha)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VeryDeepCopyU-tk.1.cs.gz
Type: application/mac-binhex40
Size: 1346 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030513/8d423735/VeryDeepCopyU-tk.1.cs.hqx
More information about the Squeak-dev
mailing list
|