Releases: expr-lang/expr
v1.17.7
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.
v1.17.6
What's Changed
v1.17.5
v1.17.4
v1.17.3
v1.17.2
v1.17.1
v1.17.0
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)`)In this release:
This release added the biggest change to the Expr language: if-else expressions and sequential expressions. #736 e750878
if foo > 42 {
assert(foo);
calc(foo, foo / 2)
} else {
calc(0, 0)
}A sequence of expression may be separated by ; char. The last semicolon must be omitted. Expr returns the value of the
last expression in the sequence.
If-else is also expressions. Each if must have an else part. Result of if-else can be used as an expression:
let foo = if bar > 0 {
process(bar)
} else {
fallback()
};
foo + 42Added:
- Added
ast.Findhelper for easy AST searching. 579de74 - Added compile node budget and memory limits (#762)
- Added
uniq()builtin (#705) - Added
flatten()builtin (#684) - Added types pkg (#665 #667 #668)
Improvements:
- Allow tailing comma in arguments (#623)
- Improved type checker for named types 6fa83ad
- Now
len()return runes count for string e8bd7f8 - Improved VM code coverage (now 98%!) (#750)
- Improved support for auto-dereferences and pointer usage 2bc0eed f4bbea5 80f0ea6 4511e92 29dff34
Fixes:
- Make sure
get()returns nil formap[string]stringon missing keys 435b79d - Fixed func calls with nil types value d63c3b5
- Fixed AST printing of ops with precedence (#678)
- Do not optimize
filter() | map()if#indexis used 35bdb68 - Separated patching phases for patchers that require multiple passes. (#659)
v1.16.9
v1.16.8
Expr is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy,
safety, and speed.
program, err := expr.Compile(`now() - created_at < duration("24h")`)In this release:
- Added checks for nil before string casts in VM (#654)
- Added int overflow checks. 45c1ae7
- Improved lexer (#653)
- Improved error messages for index out of bounds errors. 6cf0edb
- Fixed: invoke the Deref function as needed for the function arguments. (#651)
- Fixed build on 386 arch. cae6003
Expr Editor
The Expr Editor is an embeddable code editor written in JavaScript with
full support of Expr language.
Expr Pro
Expr Pro is a set of extensions for Expr for advanced use cases. It includes
expressions explanation, performance profiling, and more.