slotUnbound
slotUnbound(u_classg_objects_slotName) =>g_result
Description
This function is called when the slotValue function attempts to reference an unbound slot. It signals that the value of the slot s_slotName of g_object has not been set yet. In this case, slotValue returns the result of the method.
Arguments
|
A class object. The class must be either |
|
Value Returned
|
Value contained in the slot s_slotName. The default value is '\*slotUnbound\*. |
Examples
defclass( A () ((a)))
=> t
x = (makeInstance 'A)
=> stdobj@0x83bf018
defmethod( slotUnbound (class (obj A) slotName) (printf "slotUnbound : slot '%L'is unbound\n" slotName) (setSlotValue obj slotName 6)
)
=> t
x->a
=> slotUnbound : slot 'a' is unbound
=> 6
x->a
=> 6
defmethod( slotUnbound (class (obj A) slotName) (printf "slotUnbound : slot '%L' is unbound\n" slotName) (setSlotValue obj slotName 6)
8
)
=> t
*WARNING* (defmethod): method redefined generic:slotUnbound class:(t A t)
x->a = '\*slotUnbound\*
\*slotUnbound\*
x->a
=> slotUnbound : slot 'a' is unbound
=> 8 ;; the return value of slotUnbound method, not a new value of the slot
x->a
=> 6
Related Topics
Return to top