# HG changeset patch # User Claus Gittinger # Date 1086690622 -7200 # Node ID dea5311899c58e18fbdecfd18a31eda7cb56f646 # Parent c3fe9de270ad45ad7efa3669dedeb611fc1de51f comments in copy methods diff -r c3fe9de270ad -r dea5311899c5 Object.st --- a/Object.st Mon Jun 07 17:43:23 2004 +0200 +++ b/Object.st Tue Jun 08 12:30:22 2004 +0200 @@ -610,8 +610,7 @@ ! veryDeepCopy - - ^(self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self + ^ self deepCopyUsing:(IdentityDictionary new) ! ! !Object methodsFor:'Compatibility-VW'! @@ -2347,7 +2346,7 @@ cloneFrom:anObject performing:aSymbol "Helper for copy: - for each instance variables from anObject, send it aSymbol + for each instance variable from anObject, send it aSymbol and store the result into the receiver, which should be of the same class as the argument." @@ -2357,7 +2356,7 @@ myClass isVariable ifTrue:[ sz := self basicSize. - "copy the indexed variables" + "process the indexed instance variables" 1 to:sz do:[:i | t := anObject basicAt:i. aSymbol ~~ #yourself ifTrue:[ @@ -2367,7 +2366,7 @@ ] ]. - "copy the instance variables" + "process the named instance variables" sz := myClass instSize. 1 to:sz do:[:i | t := anObject instVarAt:i. @@ -2378,7 +2377,6 @@ ]. ^ self - ! cloneInstanceVariablesFrom:aPrototype @@ -2473,7 +2471,7 @@ "a controlled deepCopy, where the number of levels can be specified. Notice: This method DOES NOT handle cycles/self-refs and does NOT preserve object identity; - i.e. identical references in the source are copied multiple into the copy." + i.e. identical references in the source are copied multiple times into the copy." |newObject class index| @@ -2551,7 +2549,7 @@ which avoids this overhead (but may run into trouble). Notice, that deepCopy does not copy dependents." - ^ (self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self + ^ self deepCopyUsing:(IdentityDictionary new) "an example which is not handled by the old deepCopy: @@ -2615,7 +2613,7 @@ "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary iCopy := aDictionary at:iOrig ifAbsent:nil. iCopy isNil ifTrue:[ - iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy + iCopy := iOrig deepCopyUsing:aDictionary ]. aCopy basicAt:i put:iCopy ] @@ -2633,12 +2631,13 @@ iOrig notNil ifTrue:[ iCopy := aDictionary at:iOrig ifAbsent:nil. iCopy isNil ifTrue:[ - iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy + iCopy := iOrig deepCopyUsing:aDictionary ]. aCopy instVarAt:i put:iCopy ] ] ]. + aCopy postDeepCopyFrom:self. ^ aCopy " @@ -2775,8 +2774,7 @@ no recursive references occur (LargeIntegers for example). NOTICE: you will run into trouble, when trying this with recursive objects (usually recursionInterrupt or memory-alert). - This method corresponds to the 'traditional' deepCopy found in - the Blue book." + This method corresponds to the 'traditional' deepCopy found in the Blue book." |myClass aCopy| @@ -9152,7 +9150,7 @@ !Object class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.498 2004-06-07 09:30:26 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.499 2004-06-08 10:28:42 cg Exp $' ! ! Object initialize! diff -r c3fe9de270ad -r dea5311899c5 Smalltalk.st --- a/Smalltalk.st Mon Jun 07 17:43:23 2004 +0200 +++ b/Smalltalk.st Tue Jun 08 12:30:22 2004 +0200 @@ -1421,7 +1421,8 @@ ! deepCopyUsing:aDictionary - "redefined to return self - there is only one Smalltalk dictionary" + "return a deep copy of the receiver. + Redefined to return the receiver - there is only one Smalltalk dictionary" ^ self @@ -6381,5 +6382,5 @@ !Smalltalk class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.646 2004-06-07 15:26:35 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.647 2004-06-08 10:29:31 cg Exp $' ! ! diff -r c3fe9de270ad -r dea5311899c5 String.st --- a/String.st Mon Jun 07 17:43:23 2004 +0200 +++ b/String.st Tue Jun 08 12:30:22 2004 +0200 @@ -2281,7 +2281,7 @@ ! deepCopyUsing:aDictionary - "return a copy of the receiver - reimplemented to be a bit faster" + "return a deep copy of the receiver - reimplemented to be a bit faster" " could be an instance of a subclass which needs deepCopy @@ -3303,9 +3303,8 @@ ! ! - !String class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.205 2004-04-12 16:17:30 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.206 2004-06-08 10:29:55 cg Exp $' ! ! diff -r c3fe9de270ad -r dea5311899c5 Symbol.st --- a/Symbol.st Mon Jun 07 17:43:23 2004 +0200 +++ b/Symbol.st Tue Jun 08 12:30:22 2004 +0200 @@ -493,7 +493,7 @@ ! deepCopyUsing:aDictionary - "return a copy of myself + "return a deep copy of myself - reimplemented here since symbols are immutable." ^ self @@ -745,5 +745,5 @@ !Symbol class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.76 2004-05-27 14:27:03 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.77 2004-06-08 10:30:08 cg Exp $' ! ! diff -r c3fe9de270ad -r dea5311899c5 UndefinedObject.st --- a/UndefinedObject.st Mon Jun 07 17:43:23 2004 +0200 +++ b/UndefinedObject.st Tue Jun 08 12:30:22 2004 +0200 @@ -204,7 +204,7 @@ deepCopyUsing:aDictionary "return a deep copy of myself - - since there is only one nil in the system return self" + - since there is only one nil in the system, return self" ^ self ! @@ -685,7 +685,7 @@ !UndefinedObject class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.57 2004-04-07 12:59:35 werner Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.58 2004-06-08 10:30:22 cg Exp $' ! ! UndefinedObject initialize!