Repository navigation
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
&strargument is fixed. - Panic when calling
switchstatements on custom types is fixed. - Potential overflow panics in
range(from, to, step)is fixed. &mut Stringparameters 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_valueetc. 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::ErrorMismatchDataTypewhich were swapped.
Breaking changes
Dynamic::as_stris removed because it does not properly handle shared values.- Zero step in the
rangefunction now raises an error instead of creating an infinite stream. - Error variable captured by
catchis now an object map containing error fields. EvalAltResult::clear_positionis renamedEvalAltResult::take_positionand returns the position taken.privatefunctions in anASTcan now be called withcall_fnetc.NativeCallContext::call_fn_dynamic_rawno longer has thepub_onlyparameter.Module::update_fn_metadatainput 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_varandis_def_fnare now reserved keywords.Engine::idfield is removed because it is never used.num-traitsis now a required dependency.- The
inoperator is now implemented on top of thecontainsfunction and is no longer restricted to a few specific types. EvalAltResult::ErrorInExpris removed because theinoperator now callscontains.- The methods
AST::walk,Expr::walk,Stmt::walkandASTNode::walkand the callbacks they take now returnboolto 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.
rangefunction now supports negative step and decreasing streams (i.e. to < from).- More information is provided to the error variable captured by the
catchstatement in an object map. - Previously,
privatefunctions in anASTcannot be called withcall_fnetc. 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 (privateor not) can be called in anAST. Theprivatekeyword is relegated to preventing a function from being exported. Dynamic::as_unitjust for completeness sake.bytesmethod added for strings to get length quickly (if the string is ASCII-only).FileModuleResolvercan now enable/disable caching.- Recursively walking an
ASTcan now be terminated in the middle.