Move constancy into Dynamic.
This commit is contained in:
@@ -64,6 +64,15 @@ are spliced into the script text in order to turn on/off certain sections.
|
||||
For fixed script texts, the constant values can be provided in a user-defined [`Scope`] object
|
||||
to the [`Engine`] for use in compilation and evaluation.
|
||||
|
||||
### Caveat
|
||||
|
||||
If the [constants] are modified later on (yes, it is possible, via Rust functions),
|
||||
the modified values will not show up in the optimized script.
|
||||
Only the initialization values of [constants] are ever retained.
|
||||
|
||||
This is almost never a problem because real-world scripts seldom modify a constant,
|
||||
but the possibility is always there.
|
||||
|
||||
|
||||
Eager Operator Evaluations
|
||||
-------------------------
|
||||
|
@@ -11,6 +11,14 @@ There are three levels of optimization: `None`, `Simple` and `Full`.
|
||||
(i.e. it only relies on static analysis and [built-in operators] for constant [standard types],
|
||||
and will not perform any external function calls).
|
||||
|
||||
However, it is important to bear in mind that _constants propagation_ is performed with the
|
||||
caveat that, if [constants] are modified later on (yes, it is possible, via Rust functions),
|
||||
the modified values will not show up in the optimized script. Only the initialization values
|
||||
of [constants] are ever retained.
|
||||
|
||||
Furthermore, overriding a [built-in operator][built-in operators] in the [`Engine`] afterwards
|
||||
has no effect after the optimizer replaces an expression with its calculated value.
|
||||
|
||||
* `Full` is _much_ more aggressive, _including_ calling external functions on constant arguments to determine their result.
|
||||
One benefit to this is that many more optimization opportunities arise, especially with regards to comparison operators.
|
||||
|
||||
|
Reference in New Issue
Block a user