Expr is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy,
safety, and speed.
program, err := expr.Compile(`let foo = bar(); baz(foo, foo)`)This release brings new language features, performance improvements across runtime and compiler, better error
handling, and many important bug fixes.
New Features
Support for else if expressions
- You can now chain conditional branches using
else if! (#879)
Unicode escapes in the \u{XXXXXX} format
- String literals now support Unicode code point escapes such as
\u{1F600}. (#882)
Byte slice support in the matches operator
The matches operator now works with []byte, improving interoperability with binary data. (#876)
Short-circuit control options
New options allow enabling or disabling short-circuiting behavior in the compiler and VM. (#847)
Option to disable if operator
A separate DisableIfOperator option is now available. (#881)
Performance Improvements
Runtime structure fetch improvements
Accessing struct fields at runtime is now faster. (#833)
VM function call optimizations
Function calls inside the VM execute more efficiently. (#832)
Type system performance boost
Large or complex type operations now run significantly faster. (#824)
Bug Fixes
- Guard negative forward jump offsets (#861).
- Prevent stack underflow in the VM (#860).
- Correct behavior of
AsBoolwith nil and undefined variables (#866). - Proper handling of nil arguments in variadic functions (#868).
- Show function name for safe calls in disassembly (#869).
- Limit recursion depth in built-in functions (#870).
- Throw an error when a predicate is missing in the parser (#842).
- Fixed array type resolution in conditional operator (#865).
- Disallow access to unexported struct fields (#846).
- Fixed retrieving field pointers in structs (#843).
- Better error position reporting in multi-line scripts (#827).
- Support quoting backticks inside string literals (#820).
- Fixed auto-dereference for maps/slices and conditionals (#871).
- Wrap merged optimizer results as predicates (#864).
- Improved missing property handling (#854).
- Handle invalid
ifconditions and detect null-byte crashes. - Added regression tests for several reported issues.