[Cuis] [SOLVED] Re: Copy vs Clone

Ken.Dickey Ken.Dickey at whidbey.com
Wed May 13 23:16:09 CDT 2015


On Wed, 13 May 2015 23:25:37 -0300
Juan Vuletich <juan at jvuletich.org> wrote:

> 
> Well, but why do #clone or #shallowCopy? Isn't #copy ok?

Not when using closures with state. 
  Error: can only serialize clean closures

Morph>>copy serializes, but does not have to.

We can make all closures serializable (e.g. KaliScheme does this to export closures over the network).  This is clean but it is still a bit of work.

The original Object>>copy would work where I implement postCopy to set location to a new MorphicTranslation.

Object>>copy
    ^self shallowCopy postCopy


-- 
-KenD




More information about the Cuis mailing list