|
Spec-Zone .ru
спецификации, руководства, описания, API
|
A bound expression is an expression whose value updates when its dependencies change. Dependencies, the update mechanism, and the creation of bound expressions are discussed below.
[To do: define "dependencies"]
Bound expressions are evaluated in bind context; all other evaluation is in a normal context. A bound expression may not contain assignment or iteration. Assignment includes increment and decrement. Iteration is the while-loop (not for-expression).
A variable (instance, script, or local variable) can be bound to an expression. That expression, of course, is a bound expression.
A local variable definition with an initializing expression creates a binding from the local variable to the expression if the definition is explicitly bound:
def varName = bind expression
or if the definition is in a bind context.
A script variable definition with an initializing expression creates a binding from the instance variable to the expression if the definition is explicitly bound.
An instance variable definition with an initializing expression creates a binding from the instance variable to the expression if the definition is explicitly bound and is not overridden or superseded by an object literal initializing expression. Class definitions are not evaluated and thus do not have bind contexts, so instance variable initialization without an explicit bind cannot create a binding. An object literal component creates a binding from the instance variable to the expression if the component is explicitly bound:
className { instanceVariableName: bind expression }
A binding between a variable and an expression means intuitively that the variable maintains the value of the expression. Specifically, this means the variable is updated when the dependencies of the expression change.