v.0.19.14
This version runs faster due to optimizations done on AST node structures. It also fixes a number of panic bugs related to passing shared values as function call arguments.
Version 0.19.14
released to crates.io
.
Bug fixes
- Panic when passing a shared string into a registered function as
&str
argument is fixed. - Panic when calling
switch
statements on custom types is fixed. - Potential overflow panics in
range(from, to, step)
is fixed. &mut String
parameters in registered functions no longer panic when passed a string.- Some expressions involving shared variables now work properly, for example
x in shared_value
,return shared_value
,obj.field = shared_value
etc. Previously, the resultant value is still shared which is counter-intuitive. - Errors in native Rust functions now contain the correct function call positions.
- Fixed error types in
EvalAltResult::ErrorMismatchDataType
which were swapped.
Breaking changes
Dynamic::as_str
is removed because it does not properly handle shared values.- Zero step in the
range
function now raises an error instead of creating an infinite stream. - Error variable captured by
catch
is now an object map containing error fields. EvalAltResult::clear_position
is renamedEvalAltResult::take_position
and returns the position taken.private
functions in anAST
can now be called withcall_fn
etc.NativeCallContext::call_fn_dynamic_raw
no longer has thepub_only
parameter.Module::update_fn_metadata
input parameter is changed.- Function keywords (e.g.
type_of
,eval
,Fn
) can no longer be overloaded. It is more trouble than worth. To disable these keywords, useEngine::disable_symbol
. is_def_var
andis_def_fn
are now reserved keywords.Engine::id
field is removed because it is never used.num-traits
is now a required dependency.- The
in
operator is now implemented on top of thecontains
function and is no longer restricted to a few specific types. EvalAltResult::ErrorInExpr
is removed because thein
operator now callscontains
.- The methods
AST::walk
,Expr::walk
,Stmt::walk
andASTNode::walk
and the callbacks they take now returnbool
to optionally terminate the recursive walk.
Enhancements
- Layout of AST nodes is optimized to reduce redirections, so speed is improved.
- Function calls are more optimized and should now run faster.
range
function now supports negative step and decreasing streams (i.e. to < from).- More information is provided to the error variable captured by the
catch
statement in an object map. - Previously,
private
functions in anAST
cannot be called withcall_fn
etc. This is inconvenient when trying to call a function inside a script which also serves as a loadable module exporting part (but not all) of the functions. Now, all functions (private
or not) can be called in anAST
. Theprivate
keyword is relegated to preventing a function from being exported. Dynamic::as_unit
just for completeness sake.bytes
method added for strings to get length quickly (if the string is ASCII-only).FileModuleResolver
can now enable/disable caching.- Recursively walking an
AST
can now be terminated in the middle.