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





_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to