[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is 'clone' implemented?



   How is 'clone', which as I understand all objects inherit from
   the root object, implemented?  Spefically, does it perform a
   shallow or a deep copy of the slots in the receiver...  I would
   assume a deep one of some sorts or else the clones wouldn't be 
   too usable.  But what mechanism is then used to prevent clone
   from recursing to 'parent' via the slot of that name?  How about 
   other slots with non-primitive objects?

Clone is a primitive applicable to (almost) all objects, and it makes
a shallow copy.  If an object needs a deeper copy, it has to
explicitly clone sub-objects.