Rhai v1.6.0 Release Notes

  • ๐Ÿ”Œ This version, in particular, fixes a plugin macro hygiene error for the nightly compiler:

    error[E0425]: cannot find value `args` in this scope
    

    Compiler version

    • Minimum compiler version is now 1.57 due to smartstring dependency.

    ๐Ÿ› Bug fixes

    • ๐Ÿ›  Fixed macro hygiene error with nightly compiler.
    • Invalid property or method access such as a.b::c.d or a.b::func() no longer panics but properly returns a syntax error.
    • Scope::is_constant now 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.
    • FnAccess and FnNamespace now implement Ord and PartialOrd.
    • ๐Ÿ– The event_handler_map example 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 sleep is added to block the current thread by a specified number of seconds.
    • Scope::set_alias is added to export a variable under a particular alias name.
    • starts_with and ends_with are added for strings.
    • Variables in modules registered via register_global_module can now be accessed in the global namespace.
    • Dynamic::into_read_only is added to convert a Dynamic value into constant.
    • Module now holds a collection of custom types with an API.