Nicolas Cellier uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-nice.532.mcz
==================== Summary ====================
Name: Kernel-nice.532 Author: nice Time: 29 December 2010, 10:59:42.464 am UUID: 30e481ee-c2ee-4d10-8484-ec8da55ae54a Ancestors: Kernel-ar.531
A] Clean-up Behavior and Metaclass copy by using postCopy paradigm.
Advantage 1: This cleans up the false comment of Behavior>>copy (no, it does not copy without a list of subclasses). This cleans up the false comment of Metaclass>>copy (no, it does share the reference to the sole instance).
Advantage 2: The new code is shorter, simpler and avoids niling thisClass temporarily (this was dangerous).
B] Fix Class>>copy : the sharedPool shall not be shared (if you #addSharedPool: to the copy and the original already has a sharedPool, then you #addSharedPool: to the original too...). Move the comments "Answer a copy of the receiver without a list of subclasses." where it belongs, in Class>>copy.
=============== Diff against Kernel-ar.531 ===============
Item was removed: - ----- Method: Behavior>>copy (in category 'copying') ----- - copy - "Answer a copy of the receiver without a list of subclasses." - - | myCopy | - myCopy := self shallowCopy. - ^myCopy methodDictionary: self copyOfMethodDictionary!
Item was added: + ----- Method: Behavior>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + self methodDict: self methodDict copy!
Item was changed: ----- Method: Class>>copy (in category 'copying') ----- copy + "Answer a copy of the receiver without a list of subclasses." | newClass | newClass := self class copy new superclass: superclass methodDict: self methodDict copy format: format name: name organization: self organization copy instVarNames: instanceVariables copy classPool: classPool copy + sharedPools: sharedPools copy. - sharedPools: sharedPools. Class instSize+1 to: self class instSize do: [:offset | newClass instVarAt: offset put: (self instVarAt: offset)]. ^ newClass!
Item was removed: - ----- Method: Metaclass>>copy (in category 'copying') ----- - copy - "Make a copy of the receiver without a list of subclasses. Share the - reference to the sole instance." - - | copy t | - t := thisClass. - thisClass := nil. - copy := super copy. - thisClass := t. - ^copy!
Item was added: + ----- Method: Metaclass>>postCopy (in category 'copying') ----- + postCopy + "Don't share the reference to the sole instance." + + super postCopy. + thisClass := nil.!
packages@lists.squeakfoundation.org