Previous: Class Slots, Up: Accessing Slots


9.9.3 Handling Slot Access Errors

GOOPS calls one of the following generic functions when a “slot-ref” or “slot-set!” call specifies a non-existent slot name, or tries to reference a slot whose value is unbound.

— generic: slot-missing
— method: slot-missing (class <class>) slot-name
— method: slot-missing (class <class>) (object <object>) slot-name
— method: slot-missing (class <class>) (object <object>) slot-name value

When an application attempts to reference or set a class or instance slot by name, and the slot name is invalid for the specified class or object, GOOPS calls the slot-missing generic function.

The default methods all call goops-error with an appropriate message.

— generic: slot-unbound
— method: slot-unbound (object <object>)
— method: slot-unbound (class <class>) slot-name
— method: slot-unbound (class <class>) (object <object>) slot-name

When an application attempts to reference a class or instance slot, and the slot's value is unbound, GOOPS calls the slot-unbound generic function.

The default methods all call goops-error with an appropriate message.