Handles to Objects
A handle is a pointer to a variable, function, module, or other object. Using a handle lets you write variables or functions that work with the object itself, for example to access its attributes — instead of just its value which is what you usually get when you mention a variable by identifier in an expression.
Viewing handles
In a table result, a handle in an index or content cell usually shows the title of the object. If you select Show by identifier from the Object menu (or press Control+y) it toggles to show identifiers instead of titles (as it does in the node diagrams). If you double-click a cell containing a handle (title or identifier) it opens its Object window (as it does when you double-click a node in a diagram).
Attributes that contain handles
The attributes, inputs, outputs, and contains (the list of objects in a module) each consist of a list of handles to objects. The attribute isIn is a single handle to the module that contains this object — the inverse of contains.
List of variables: [v1, v2, ... vn]
If you define a variable as a list of variables, for example,
Variable A := [X, Y, Z]
the variable will have a self index that is a list of handles to those variables. In a table result view of A (or other variable that uses this index), the index A will usually show the titles of the variables. See “List of variables” on page 175 for more. In an expression, the handles in the self index can be accessed using IndexValue(A). The main value of A (either mid value or a probabilistic view of A) contains the results of evaluating X, Y and Z.
Handle(o)
Returns a handle to an Analytica object, given its identifier o.
Handle(Va1) ¨ Va1
HandleFromIdentifier(text)
Returns a handle to global object (i.e., not a local variable or parameter), given its identifier as text.
Variable B := 99
HandleFromIdentifier("B") → Va1
The dependency maintenance is unaware of the dependency on the object. Hence, any changes to the variable B above will not cause the result to recompute.
ListOfHandles(identifiers...)
Returns a list of handles to the specified Analytica objects, given their identifiers.
ListOfHandles(Va1,Va2,Va3) ¨ [Va1,Va2,Va3]
Indexes of Handles
MetaOnly attribute
When an index object is defined as a list of identifiers, the MetaOnly attribute controls whether it is treated as a general index or a meta-index. Meta-indexes are useful when reasoning about the structure or contents of the model itself. A general index evaluates the variables appearing in its definition to obtain its mid or sample value, and the values that are recognized by Subscript (i.e., a[i=x]), while a meta-index (having its metaOnly attribute set to 1) does not evaluate the objects in the list. The following comparisons demonstrates the similarities and differences.
Constant E:= exp(1)
Variable X := -1
General Index Meta-Index Index I0 := [E,X,Pi,True] Index I1 := [E,X,Pi,True] MetaOnly of I0 := 0 {or not set} MetaOnly of I1 := 1
|- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |} |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |} |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |} |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |} |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |- |style="width:300px;" right-border="1"| |style="width:300px;" right-border="1"| |}
Enable comment auto-refresher