Minor fine tuning.
This commit is contained in:
13
README.md
13
README.md
@@ -1,6 +1,13 @@
|
||||
Rhai - Embedded Scripting for Rust
|
||||
=================================
|
||||
|
||||

|
||||
[](http://travis-ci.org/jonathandturner/rhai)
|
||||
[](https://github.com/license/jonathandturner/rhai)
|
||||
[](https::/crates.io/crates/rhai/)
|
||||

|
||||
[](https://docs.rs/rhai/)
|
||||
|
||||
Rhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way to add scripting to any application.
|
||||
|
||||
Rhai's current features set:
|
||||
@@ -1464,9 +1471,9 @@ Function volatility considerations
|
||||
|
||||
Even if a custom function does not mutate state nor cause side effects, it may still be _volatile_, i.e. it _depends_ on the external
|
||||
environment and not _pure_. A perfect example is a function that gets the current time - obviously each run will return a different value!
|
||||
The optimizer, when using [`OptimizationLevel::Full`], _assumes_ that all functions are _pure_, so when it finds constant arguments.
|
||||
This may cause the script to behave differently from the intended semantics because essentially the result of each function call will
|
||||
always be the same value.
|
||||
The optimizer, when using [`OptimizationLevel::Full`], _assumes_ that all functions are _pure_, so when it finds constant arguments
|
||||
it will eagerly run execute the function call. This causes the script to behave differently from the intended semantics because
|
||||
essentially the result of the function call will always be the same value.
|
||||
|
||||
Therefore, **avoid using [`OptimizationLevel::Full`]** if you intend to register non-_pure_ custom types and/or functions.
|
||||
|
||||
|
Reference in New Issue
Block a user