The less-familiar parts of Lisp for beginners — update-instance-for-redefined-class

With the update-instance-for-redefined-class generic function, we encounter, once again, the concept of redefined classes in Lisp.  This has no parallel in C++, the programmer changes the slots within a class even while there exist instances of the class.

The programmer should not call this function directly, it is invoked by the system when necessary.

This generic function behaves much like update-instance-for-different-class, and most of what was described there is true here, but with one important exception.  In the former case, the original and new class definitions both existed, so objects of both types could be present at the same time, and the accessors for the original class were still available.  Now, the redefined class means that the original class definition is no longer valid, so the code cannot examine it through any of the normal methods.  The accessors are no longer available, and slot-value has nothing to work on.  As the programmer might need to examine the contents of slots that have been deleted in the class redefinition, there is a mechanism for that in the invocation of this generic function.  They are supplied in a property list that is passed to this method.

Once again, by writing a specialized :after method on this generic function, the programmer can examine the property list and take action based on the values in discarded slots.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

反垃圾邮件 / Anti-spam question * Time limit is exhausted. Please reload CAPTCHA.