2010/1/12 Bouraqadi Noury <[email protected]>: > Hi, > > I found the clone primitive method in the Object class. > Its behavior looks the same as shallowCopy. Actually, shallowCopy just > sends basicShallowCopy wich calls the same primitive as clone > (primitive 148). > > a1 := Array with: Object new. > a2 := a1 clone. > a1 == a2. "--->false" > a1 first == a2 first. "--->true" > > When I look to senders (in a pharo-dev 12.2) I find the following: > -62 senders of clone. > -2 senders of basicShallowCopy > -66 senders of shallowCopy > > Looking to implementors I found: > -9 implementors of shallowCopy (all are kernel classes) > -1 implementor of basicShallowCopy (not surprizing) > -6 implementors of clone (all are kernel classes) > > Most implementors of clone and shallowCopy are different. > Yet, implementations done by same classes are the same behavior. > Other implementations of clone answer self, because there are for > objects that should/can't be copied (e.g. SmallInteger, Character). > > So, I suggest to remove clone and use shallowCopy instead (better/more > precise name). > Anybody has any reeason against? Otherwise, I'll do it. > > Noury > >
basicShallowCopy was a workaround for some badly written copy in OrderedCollection. I did add it, then removed it in squeak/trunk. I suggest following the same path in Pharo. You can also remove Float>>shallowCopy since super would perform as well. I corrected it recently for fun, but it should better be removed (was removed from squeak/trunk). For clone, I don't know. Nicolas > > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
