#1007 deep copy of objects

jessevdam Fri 5 Mar 2010

I miss an option to do a deep copy of set of object. I can use serialization and do a deserialization afterwards, but that is not the nicest why of doing so.

Did I miss something or is it not present (yet)?

jodastephen Fri 5 Mar 2010

Thread `http://fantom.org/sidewalk/topic/311` and `http://fantom.org/sidewalk/topic/492` have some info. There are others. So, yes, this is needed.

brian Fri 5 Mar 2010

I've always thought that there should be something like Obj.dup. But cloning objects is an ugly messy affair without clear semantics which can be imposed on all subclasses. Shallow to deep clones is actually more of a spectrum than a black and white issue.

So at some point we'll have to design clear semantics and API.

Until that point, the easiest technique is to just implement in your classes, and use dynamic invoke.

Login or Signup to reply.