sharedInitialize
sharedInitialize(g_objectg_slotList@restl_initargs) =>g_object /error
Description
This is a generic function, which is called when an instance is created, re-initialized, updated to conform to a redefined class, or updated to conform to a different class. It is called from the initializeInstance, updateInstanceForRedefinedClass, and updateInstanceForDifferentClass functions to initialize slots of the instance g_object using the corresponding initforms.
If the function is successful, the updated instance is returned.
Arguments
|
|
|
Value Returned
Examples
defclass( A () ((a @initform 1)))
=> t
defmethod( sharedInitialize ((obj A) slots @key k @rest args)
(printf "sharedInitialize A: obj->?? == '%L' k == '%L' args == '%L'\n" obj->?? k args)
(callNextMethod)
)
=> t
defclass( B () ((b @initform 2)))
=> t
x = makeInstance( 'A ?k 9)
sharedInitialize A: obj->?? == '(a \*slotUnbound\*)' k == '9' args == 'nil'
=> stdobj@0x83bf018
defclass( A () ((a @initform 1)
(c @initform 3)))
*WARNING* (defclass): redefinition of class A updating stdobj@0x83bf018 sharedInitialize A: obj->?? == '(a 1 c \*slotUnbound\*)' k == 'nil' args == 'nil'
=> t
changeClass( x 'B ?k 7)
updating stdobj@0x83bf018
stdobj@0x83bf018
x->??
(b 2)
changeClass( x 'A ?k 7)
updating stdobj@0x83bf018
sharedInitialize A: obj->?? == '(a \*slotUnbound\* c \*slotUnbound\*)' k == '7' args == 'nil'
stdobj@0x83bf018
x->??
(a 1 c 3)
Related Topics
Return to top