Difference between Object>>clone and Object>>shallowCopy
Rob Withers
rwithers12 at mediaone.net
Tue Jan 15 07:24:43 UTC 2002
At 02:13 PM 1/14/2002, you wrote:
>Similar to basicAt:, clone should not be overridden so that you can always
>get the primitive clone behavior for any object. ShallowCopy might be
>overridden,
>depending on the semantics of the receiver.
John, I see that all of the unique classes override clone to maintain this
quality. I believe there may be very special cases, where one would want
to override clone, namely first-class Reference objects that act as
Forwarders, for either the purpose of blocking cloning, getting authorizing
whether to clone, or to even cause the clone to occur remotely, if that's
what is needed. Luckily it isn't a bytecode like #class and #==.
Speaking of which, do you see any problems with removing/normalSending the
bytecode for #== and making it double dispatch to a
#basicEquivalentTo:? It buys us the ability, in very special
circumstances, to change the meaning of identity.
cheers,
Rob
More information about the Squeak-dev
mailing list
|