[squeak-dev] Class>>deepCopy???
Michael van der Gulik
mikevdg at gmail.com
Fri May 2 09:31:14 UTC 2008
Hi all.
Why am I not meant to make a deep copy of a class? From the source for TraitBehavior>>deepCopy (which in 3.9 is the method that is invoked when you invoke #deepCopy on a class):
deepCopy
"Classes should only be shallowCopied or made anew."
^ self shallowCopy
Ditto applies for Class>>copy.
Surely, a shallow copy of a class is less useful than a deep copy because any modifications to the copy would also modify the original? Are there other reasons for copying a class other than to make a modifiable copy?
Gulik.
--
Michael van der Gulik <mikevdg at gmail.com>
More information about the Squeak-dev
mailing list
|