up previous next
ImportByRef, ImportByValue
|
import an external variable by reference or value
ImportByRef X;
ImportByValue X;
where
X
is the name of a variable in the containing scope.
|
***YOU PROBABLY SHOULDN'T USE THESE COMMANDS YET!***
It seems that they can be used only inside anonymous functions (see
func
).
These commands "import" an external variable by reference or value.
ImportByValue
creates a local variable with the given name, and its
initial value is taken from the variable of the same name in the context the
anonymous function is defined.
ImportByRef
creates a reference to
the named variable in the context where the anonymous function is defined.
NOTE: Package variables should be accessed directly (via the fully qualified
name); they cannot be imported.
/**/ Define add(X)
/**/ AnonFn := Func(Y) ImportByValue X; Return X+Y; EndFunc;
/**/ Return AnonFn;
/**/ EndDefine;
/**/ add3 := add(3);
/**/ add3(2);
5
|