Rhai v1.2.0 Release Notes
-
๐ Bug fixes (potentially script-breaking)
- 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 underno_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 andEngine::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 underno_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 andNativeCallContext::call_fn_raw
is added.- ๐
From<EvalAltResult>
forResult<T, Box<EvalAltResult> >
is deprecated so it will no longer be possible to doEvalAltResult::ErrorXXXXX.into()
to convert to aResult
; instead,Err(EvalAltResult:ErrorXXXXX.into())
must be used. Code is clearer if errors are explicitly wrapped inErr
.
- As originally intended, function calls with a bang (