Product Documentation
Cadence SKILL++ Object System Reference
Product Version IC23.1, June 2023

sharedInitialize

sharedInitialize( 
g_object 
g_slotList 
@rest l_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

g_object

An instance of a class.

g_slotList

t or a list of slot names (symbols). If the argument is t, it initializes all uninitialized slots. If it is a list of slot names, it initializes only the uninitialized slots in the list.

@rest l_initargs

List of optional initargs.

Value Returned

g_object

The updated instance (g_object).

error

When the updated instance is not 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

Classes and Instances


Return to top
 ⠀
X