This system variable controls whether the Analytica evaluation engine is allowed to skip computations when it can determine that the result of the computation will have no impact on the final result. A value a 0 means it is disabled, a value of 1 means it is enabled.

For example, suppose you have a User-defined function

Function F(x : atom)

and then you evaluate the expression F(A)[J = 3]. This direct way of evaluating this would be to evaluate F(aj) for every atom of the array A, and then retain only the [J = 3] slice. With this direct evaluation, a lot of wasted computation occurs. When EnableEvalContextUse is 0, direct evaluation is used, but with EnableEvalContextUse turned on, F would be evaluated only for the cells in the [J = 3] slice.

Dimensionality declarations

Local variable declarations can include required dimensionality, for example

Local x[J] := y;


Local z[ ] := A;

These declarations establish a contract with the evaluation engine stating that when the body expression is evaluated, the local variable can have only the stated declarations. Numerous opportunities may arise to avoid wasteful iterations, and in doing so these may change the number of times the body gets evaluated.

Variable declarations using Local, LocalAlias, Atomic or the deprecated Var..Do are all impacted, where evaluations of the body code might be skipped when the result has no impact on the expression's result.

The For..Do construct is never optimized by dropping iterations.


The use of evaluation context to skip computations does not consider side-effects. As a functional and referentially-transparent modeling and programming language, Analytica expressions usually do not have side-effects. This is much different from an imperative programming language (like Java, C/C++, Perl, etc.) where the whole function of a block of code is to create a side-effect. The key point is side-effects that depend on an expression actually being evaluated or iterated may be thrown off by this context use optimization. Side-effects might include showing the user a MsgBox, appending a line to a file, altering a local variable, or altering a global variable from a button OnClick event, etc.

Turning it off

You can change the system variable to 0 to turn off this speed optimization. Doing so, however, impacts the entire model. You might consider doing so in a legacy model (pre-4.6), if you find the model is impacted. Otherwise, it is better to turn it off only in localized places using SetEvaluationFlag.


This optimization and this system variable were introduced for the first time in Analytica 4.6.

See Also


You are not allowed to post comments.