Design

Expressions are implemented as small modules that are created, compiled, and managed by a priority service called ExpressionManager. They run in the scope of the tag that uses them. In a remote application, expressions are run on each PC separately; thus it is possible to write an expression that can return a different value on each PC running it. For example, it is likely that Now() would evaluate to a different value on different PCs.

Each module is launched into the scope of the tag or tag drawing method that "owns" it. This allows VTS programmers to make use of internal tag variables in their expressions, if such variables are part of a published interface.

The implementation of each module looks like this:

[ Value; ] Only [ Value=(<your code here>); ]
Value is steady-stated to the result of the expression, which allows running expressions to look like tag references to modules that aggregate them. Two hidden variables named *script and *magic are added to each expression after compilation. *script holds the source for the running expression (<your code here> in the source above). *magic is used internally by the ExpressionManager. These variables are hidden to ensure that they do not conflict with variables in the scope in which they are running. They are not for use by code outside of the ExpressionManager (use ToString() and IsExpression() instead).