libObjectInitializerobject | misc.t[2309]

Static object and class initializer.

During startup, we'll automatically call the classInit() method for each class object, and we'll call the default constructor for each static object instance. ("Static" objects are those defined directly in the source code, as opposed to objects created dynamically with 'new'.) This makes it easier to write initialization code by making the process more uniform across static and dynamic objects.

The first step is to call classInit() on each class. We call this method only each class that *directly* defines the method (i.e., we don't call it on classes that only inherit the method from another class). We cycle through the objects in arbitrary order. However, you can control the relative order when there's a dependency by setting the 'classInitFirst' property to a list of one or more classes to initialize first. When we encounter a class with this property, we'll call the listed classes' classInit() methods before calling the given class's classInit().

The second step is to call constructStatic() or construct() on each regular (non-class) object. We only call this on *static* objects: objects defined directly in the source code, as opposed to created dynamically with 'new'. As with classInit(), we visit the objects in arbitrary order. You can control dependencies using the 'constructFirst' method: set this to a list of objects to be initialized before self.

If an object defines or inherits a constructStatic() method, we'll call it instead of construct(). Otherwise, if it defines or inherits a construct() method with no arguments, we'll call it. Otherwise we'll do nothing.

Note that it's possible for a base class to have a compatible zero-argument constructor, but for a subclass to override this with a constructor that takes arguments. In this case, we'll search the class tree for an inherited zero-argument constructor. If we find one, we'll call the inherited constructor.

We can only call zero-argument construct() methods because we have no basis for providing other arguments.

`libObjectInitializer : PreinitObject`

Superclass Tree (in declaration order)

`libObjectInitializer`
`PreinitObject`
`ModuleExecObject`
`object`

Summary of Properties

`_initedTab execBeforeMe`

Inherited from `PreinitObject` :
`reverseGlobalSymbols`

Inherited from `ModuleExecObject` :
`execAfterMe hasInitialized_ isDoingExec_ isExecuted_`

Summary of Methods

`callConstructor execute`

``

Inherited from `ModuleExecObject` :
`_execute classExec`

Properties

`_initedTab` | `misc.t[2436]`

table of objects we've already initialized

`execBeforeMe` OVERRIDDEN | `misc.t[2310]`

no description available

Methods

`callConstructor (obj, conProp, preProp)` | `misc.t[2382]`

call the given object's constructor

`execute ( )`OVERRIDDEN | `misc.t[2311]`

no description available

Adv3Lite Library Reference Manual
Generated on 01/03/2024 from adv3Lite version 1.6.2