Common Lisp the Language, 2nd Edition

next up previous contents index
Next: Modifying the Structure Up: Programmer Interface Concepts Previous: Extensions

28.1.11. Changing the Class of an Instance

The function change-class can be used to change the class of an instance from its current class, , to a different class, ; it changes the structure of the instance to conform to the definition of the class .

Note that changing the class of an instance may cause slots to be added or deleted.

When change-class is invoked on an instance, a two-step updating process takes place. The first step modifies the structure of the instance by adding new local slots and discarding local slots that are not specified in the new version of the instance. The second step initializes the newly added local slots and performs any other user-defined actions. These steps are further described in the following two sections.