Skip to content

v1.2.0

Compare
Choose a tag to compare
@schungx schungx released this 19 Nov 06:56
df07eaa

Version 1.2.0 released to crates.io.

Bug fixes with breaking script changes

  • As originally intended, function calls with a bang (!) now operates directly on the caller's scope, allowing variables inside the scope to be mutated.
  • As originally intended, Engine::XXX_with_scope API's now properly propagate constants within the provided scope also to functions in the script.
  • Printing of integral floating-point numbers is fixed (used to only prints 0.0).
  • func!() calls now work properly under no_closure.
  • Fixed parsing of unary negation such that expressions like if foo { ... } -x parses correctly.

New features

  • #[cfg(...)] attributes can now be put directly on plugin functions or function defined in a plugin module.
  • A custom syntax parser can now return a symbol starting with $$ to inform the implementation function which syntax variant was actually parsed.
  • AST::iter_literal_variables is added to extract all top-level literal constant/variable definitions from a script without running it.
  • Engine::call_fn_dynamic is deprecated and Engine::call_fn_raw is added which allows keeping new variables in the custom scope.

Enhancements

  • Array methods now avoid cloning as much as possible (although most predicates will involve cloning anyway if passed a closure).
  • Array methods that take function pointers (e.g. closures) now optionally take the function name as a string.
  • Array adds the dedup method.
  • Array adds a sort method with no parameters which sorts homogeneous arrays of built-in comparable types (e.g. INT).
  • Inlining is disabled for error-path functions because errors are exceptional and scripts usually fail completely when an error is encountered.
  • The optimize module is completely eliminated under no_optimize, which should yield smaller code size.
  • NativeCallContext::position is added to return the position of the function call.
  • Scope::clone_visible is added that copies only the last instance of each variable, omitting all shadowed variables.

Deprecated API's

  • NativeCallContext::call_fn_dynamic_raw is deprecated and NativeCallContext::call_fn_raw is added.
  • From<EvalAltResult> for Result<T, Box<EvalAltResult>> is deprecated so it will no longer be possible to do EvalAltResult::ErrorXXXXX.into() to convert to a Result; instead, Err(EvalAltResult:ErrorXXXXX.into()) must be used. Code is clearer if errors are explicitly wrapped in Err.