new
or
localNew
class-methods.
The following instance-fields are defined for each object:
self
- Contains the object-command.
selfns
- Contains the object's namespace.
class
- Contains the class-command that this object
is an instance of.
fimport
- Deletes the object.
delete
- Deletes the object.
fget
- Returns the value of an instance-field.
fset
- Sets the value of an instance-field.
fref
- Get the fully qualified reference (name) of an instance-field.
fields
- Return a list of fields associate with the object.
fimport
$cmd fimport ?field0? ?field1? ...Imports and instance-fields into a method as local variables. Unlike other instance-methods, fields are not automatically available within a method. The
fimport
binds the fields to local variables
of the method. If the fields are explicitly specified to the command, only
those fields are imported. If no fields are specified, all of the object's
fields will be imported.
The variable
command can also be used to import instance-fields.
This maybe faster if only a small number of fields are to be imported.
Class-fields are not imported. Normally they are just accessed through class-methods, however they maybe imported using:
variable ${classns}::name
delete
$cmd deleteDeletes the object.
fget
$cmd fget nameReturns the value of an instance-field
name
.
The argument name
may refer to a scalar or
a array element.
fset
$cmd fset nameSets the value of an instance-field
name
to
value
.
The argument name
may refer to a scalar or
a array element.
fref
$cmd fref fieldGet the fully qualified reference (name) of instance-field
field
.
This allows instance-fields to be passed by name to procedures and commands.
For example:
array names [$obj fref table]
fields
$cmd fieldsGet a list of all fields associated with the object. They may not necessarly have values assigned.
construct
construct ?arg0? ?arg1? ...If the
construct
method is defined, it will be called when
the object is created to initialize its fields. All arguments specified to
new
or
localNew
class-methods
are passed to construct
, which should have the appropriate
number of arguments defined.
destruct
destructIf the
destruct
method is defined when the object is
instantiated, it will be called the object is deleted.
Note, this will not handle that don't not go through the class or
object delete
method; executing namespace delete
on an object's namespace will product undefined results.