v1.2.0
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_scopeAPI'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 { ... } -xparses 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_variablesis added to extract all top-level literal constant/variable definitions from a script without running it.Engine::call_fn_dynamicis deprecated andEngine::call_fn_rawis 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
dedupmethod. - Array adds a
sortmethod 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
optimizemodule is completely eliminated underno_optimize, which should yield smaller code size. NativeCallContext::positionis added to return the position of the function call.Scope::clone_visibleis added that copies only the last instance of each variable, omitting all shadowed variables.
Deprecated API's
NativeCallContext::call_fn_dynamic_rawis deprecated andNativeCallContext::call_fn_rawis 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.