v1.6.0
This version, in particular, fixes a plugin macro hygiene error for the nightly compiler:
error[E0425]: cannot find value `args` in this scope
rhai_codegen needs to be version 1.4.0. Run cargo update if it is a lower version.
Compiler version
- Minimum compiler version is now
1.57due tosmartstringdependency.
Bug fixes
- Fixed macro hygiene error with nightly compiler.
- Invalid property or method access such as
a.b::c.dora.b::func()no longer panics but properly returns a syntax error. Scope::is_constantnow returns the correct value.- Exporting a variable that contains a local function pointer (including anonymous function or closure) now raises a runtime error.
- Full optimization is now skipped for method calls.
New features
- Type aliases in plugin modules are now used as friendly names for custom types. This makes plugin modules more self-contained when they are used to define a custom type's API.
Enhancements
- Variable definitions are optimized so that shadowed variables are reused as much as possible to reduce memory consumption.
FnAccessandFnNamespacenow implementOrdandPartialOrd.- The
event_handler_mapexample is enhanced to prevent shadowing of the state object map. - Separation of constants in function calls is removed as its performance benefit is dubious.
- A function
sleepis added to block the current thread by a specified number of seconds. Scope::set_aliasis added to export a variable under a particular alias name.starts_withandends_withare added for strings.- Variables in modules registered via
register_global_modulecan now be accessed in the global namespace. Dynamic::into_read_onlyis added to convert aDynamicvalue into constant.Modulenow holds a collection of custom types with an API.