Node:Cloning Objects, Next:, Previous:Object Comparisons, Up:Miscellaneous Functions



3.11.4 Cloning Objects

shallow-clone generic
shallow-clone (self <object>) method
Return a "shallow" clone of self. The default method makes a shallow clone by allocating a new instance and copying slot values from self to the new instance. Each slot value is copied either as an immediate value or by reference.

deep-clone generic
deep-clone (self <object>) method
Return a "deep" clone of self. The default method makes a deep clone by allocating a new instance and copying or cloning slot values from self to the new instance. If a slot value is an instance (satisfies instance?), it is cloned by calling deep-clone on that value. Other slot values are copied either as immediate values or by reference.