Skip to content

v.0.19.2

Compare
Choose a tag to compare
@schungx schungx released this 16 Oct 13:36
bd90f3c

This version adds a variable resolver with the ability to short-circuit variable access,
plus a whole bunch of array methods.

Version 0.19.2 released to crates.io.

Breaking changes

  • AST::iter_functions now returns an iterator instead of taking a closure.
  • Module::get_script_function_by_signature renamed to Module::get_script_fn and returns &<Shared<ScriptFnDef>>.
  • Module::num_fn, Module::num_var and Module::num_iter are removed and merged into Module::count.
  • The merge_namespaces parameter to Module::eval_ast_as_new is removed and now defaults to true.
  • GlobalFileModuleResolver is removed because its performance gain over the FileModuleResolver is no longer very significant.
  • The following EvalAltResult variants are removed and merged into EvalAltResult::ErrorMismatchDataType: ErrorCharMismatch, ErrorNumericIndexExpr, ErrorStringIndexExpr, ErrorImportExpr, ErrorLogicGuard, ErrorBooleanArgMismatch
  • Scope::iter_raw returns an iterator with an additional field indicating whether the variable is constant or not.
  • rhai::ser and rhai::de namespaces are merged into rhai::serde.
  • New reserved symbols: ++, --, .., ....
  • Callback signature for custom syntax implementation function is changed to allow for more flexibility.
  • Default call stack depth for debug builds is reduced to 12 (from 16).
  • Precedence for ~ is raised, while in is moved below logic comparison operators.

New features

  • New Engine::on_var to register a variable resolver.
  • const statements can now take any expression (or none at all) instead of only constant values.
  • OptimizationLevel::Simple now eagerly evaluates built-in binary operators of primary types (if not overloaded).
  • is_def_var() to detect if variable is defined, and is_def_fn() to detect if script function is defined.
  • Dynamic::from(&str) now constructs a Dynamic with a copy of the string as value.
  • AST::combine and AST::combine_filtered allows combining two AST's without creating a new one.
  • map, filter, reduce, reduce_rev, some, all, extract, splice, chop and sort functions for arrays.
  • New Module::set_iterable and Module::set_iterator to define type iterators more easily. Engine::register_iterator is changed to use the simpler version.

Enhancements

  • Many one-liners and few-liners are now marked #[inline] or [inline(always)], just in case it helps when LTO is not turned on.