[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A metaclass for classes which want to keep track of their instances
- Subject: A metaclass for classes which want to keep track of their instances
- From: Mark Nahabedian <naha@RIVERSIDE.SCRC.Symbolics.COM>
- Date: Fri, 7 May 1993 12:06-0400
The file instance-interning-class.lisp in the contrib directory (see
file reference) implements a CLOS metaclass to be used for defining
classes which will record all of their instances.
;;; A metaclass for classes which want to keep track of their instances.
;;; 1992, 1993, Mark Nahabedian, Cambridge MA. firstname.lastname@example.org
;;; This file implements a metaclass called INSTANCE-INTERNING-CLASS.
;;; All instances which are created for a class whose metaclass is
;;; INSTANCE-INTERNING-CLASS are recorded in an instance registry object
;;; (defined below).
;;; When you make a new instance of a class whose metaclass is
;;; INSTANCE-INTERNING-CLASS, MAKE-INSTANCE first checks to see if an
;;; existing instance matches the initialization arguments based on
;;; criteria which can be controlled by specializing the
;;; INSTANCE-INITARGS-MATCH method.
;;; MCL doesn't implement VALIDATE-SUPERCLASS. It is therefore up to
;;; the programmer to make sure that all subclasses of a class which is
;;; of metaclass INSTANCE-INTERNING-CLASS are also of metalcass
;;; Any instance-interning-class can be given its own instance registry.
;;; By default, an instance registry is only created for the outermost
;;; instance-interning-class on a class's precedence list.