[squeak-dev] Class>>deepCopy???

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Class>>deepCopy???

Michael van der Gulik-2
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 <[hidden email]>