next up previous

9.3.3 Slots

Slots are placeholders for values associated with instances of a user-defined class. Each instance has a copy of the set of slots specified by the immediate class as well as any obtained from inheritance. Only available memory limits the number of slots. The name of a slot may be any symbol with the exception of the keywords isa and name which are reserved for use in object patterns.

To determine the set of slots for an instance, the class precedence list for the instance's class is examined in order from most specific to most general (left to right). A class is more specific than its superclasses. Slots specified in any of the classes in the class precedence list are given to the instance, with the exception of no-inherit slots (see section 9.3.3.5). If a slot is inherited from more than one class, the definition given by the more specific class takes precedence, with the exception of composite slots (see section 9.3.3.6).

Example

(defclass A (is-a USER)
    (slot fooA)
    (slot barA))
(defclass B (is-a A)
    (slot fooB)
    (slot barB))

The class precedence list of A is: A USER OBJECT. Instances of A will have two slots: fooA and barA. The class precedence list of B is: B A USER OBJECT. Instances of B will have four slots: fooB, barB, fooA and barA.

Just as slots make up classes, facets make up slots. Facets describe various features of a slot that hold true for all objects which have the slot: default value, storage, access, inheritance propagation, source of other facets, pattern-matching reactivity, visibility to subclass message-handlers, the automatic creation of message-handlers to access the slot, the name of the message to send to set the slot and constraint information. Each object can still have its own value for a slot, with the exception of shared slots (see section 9.3.3.3).

9.3.3.1 Slot Field Type

9.3.3.2 Default Value Facet

9.3.3.3 Storage Facet

9.3.3.4 Access Facet

9.3.3.5 Inheritance Propagation Facet

9.3.3.6 Source Facet

9.3.3.7 Pattern-Match Reactivity Facet

9.3.3.8 Visibility Facet

9.3.3.9 Create-Accessor Facet

9.3.3.10 Override-Message Facet

9.3.3.11 Constraint Facets



next up previous