v1.13.0
This version attempts a number of optimizations that may yield small speed improvements:
- Simple operators (e.g. integer arithmetic) are inlined to avoid the overhead of a function call.
- The tokenizer uses pre-calculated tables (generated by GNU
gperf) for keyword recognition. - A black-arts trick (see
Engine::black_box) is used to prevent LLVM from optimizing hand-tuned AST node matches back into a lookup table, which messes up branch prediction on modern CPU's.
Bug fixes
- Complex indexing/dotting chains now parse correctly, for example:
a[b][c[d]].e mapandfilterfor arrays are markedpure. Warnings are added to the documentation of pure array methods that takethisclosures.- Syntax such as
foo.bar::bazno longer panics, but returns a proper parse error. - Expressions such as
!insidenow parses correctly instead of as!infollowed byside. - Custom syntax starting with symbols now works correctly and no longer raises a parse error.
- Comparing different custom types now works correctly when the appropriate comparison operators are registered.
- Some op-assignments, such as
x += ywherexandyarechar, now work correctly instead of failing silently. - Op-assignments to bit flags or bit ranges now work correctly.
Potentially breaking changes
- The trait method
ModuleResolver::resolve_raw(which is a low-level API) now takes a&mut Scopeparameter. This is a breaking change because the signature is modified, but this trait method has a default and is rarely called/implemented in practice. Module::eval_ast_as_new_raw(a low-level API) now takes a&mut Scopeinstead of theScopeparameter. This is a breaking change because the&mutis now required.Engine::allow_loop_expressionsnow correctly defaults totrue(was erroneouslyfalseby default).
Enhancements
Engine::new_rawis nowconstand runs very fast, delaying all other initialization until first use.- The functions
minandmaxare added for numbers. - Range cases in
switchstatements now also match floating-point and decimal values. In order to support this, however, small numeric ranges cases are no longer unrolled. - Loading a module via
importnow gives the module access to the current scope, including variables and constants defined inside. - Some very simple operator calls (e.g. integer add) are inlined to avoid the overhead of a function call, resulting in a small speed improvement.
- The tokenizer now uses table-driven keyword recognizers generated by GNU
gperf. At least theoretically it should be faster... - The field
isAnonymousis added to JSON functions metadata.