© Tyl Software Foundation 2019-2021
▶ DYNAMIC SYSTEM MODULES
Working with Instance Modules
An instance module initialization and operation:
cshaper shaper 'Circle' 10
cshaper.draw
print cshaper.shape
To make an instance of a module, means to define a
variable that will be acting as that module.
So in line
In line
More on working with dynamic system modules can be found in Dynamic System Modules Reference
cshaper shaper 'Circle' 10
, we prepend the module name
'shaper', with the instance name 'cshaper', that will be the instance
variable, or simply, the instance. This variable differs from other
Tyl variables. It does not participate in assignment statements and can not be
passed as an argument to a function, but on the other hand, it have all module
variables, and can operate all module functions, by the format
instance.variable
and instance.function
respectively.
In line
print cshaper.shape
, shape
variable of shaper
module was accessed
with cshaper
instance, and in line cshaper.draw
, draw
function of shaper
module was called with cshaper
instance. Note that unlike single modules
that their one and only module is recognized and active anywhere in the
code, instance modules rules of scoping
are the same as other variables.
More on working with dynamic system modules can be found in Dynamic System Modules Reference