Next: , Previous: Object Comparisons, Up: GOOPS


9.18 Cloning Objects

— generic: shallow-clone
— method: shallow-clone (self <object>)

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.

— generic: deep-clone
— method: deep-clone (self <object>)

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.