Skip to content

v1.6.0

Compare
Choose a tag to compare
@schungx schungx released this 30 Mar 00:05
· 1309 commits to main since this release
82cc4b5

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.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.