Difference between Object>>clone and Object>>shallowCopy

John.Maloney at disney.com John.Maloney at disney.com
Mon Jan 14 19:13:40 UTC 2002


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.

Incidentally, we didn't always have a "clone" primitive. In early versions
of Squeak, shallowCopy was written using "instVarAt:" and "instVarAt:put:".

Re: at: and basicAt:

You're right, the primitive failure code should probably be the same for both.

	-- John


At 5:13 PM +0100 1/13/02, ducasse wrote:
>Hi
>
>Is there a difference between Object>>clone and Object>>shallowCopy?
>I'm thinking that there is no difference since they both "invoke" primitive
>148. If there is no difference can somebody tells why do both exist?
>
>Thanks
>
>Stef






More information about the Squeak-dev mailing list