Rhai v1.1.0 Release Notes
-
๐ Bug fixes
- Custom syntax starting with a disabled standard keyword now works properly.
- ๐ When calling
Engine::call_fn
, new variables defined during evaluation of the body script are removed and no longer spill into the function call. - ๐
NamespaceRef::new
is fixed.
โจ Enhancements
Engine
APIEngine::consume_XXX
methods are renamed toEngine::run_XXX
to make meanings clearer. Theconsume_XXX
API is deprecated.Engine::register_type_XXX
are now available even underno_object
.- ๐ Added
Engine::on_parse_token
to allow remapping certain tokens during parsing. - Added
Engine::const_empty_string
to merge empty strings into a single instance.
Custom Syntax
- ๐
$symbol$
is supported in custom syntax to match any symbol. - Custom syntax with
$block$
,}
or;
as the last symbol are now self-terminating (i.e. no need to attach a terminating;
).
Dynamic
ValuesDynamic::as_string
andDynamic::as_immutable_string
are deprecated and replaced byinto_string
andinto_immutable_string
respectively.- โ Added a number of constants to
Dynamic
. - โ Added a number of constants and
fromXXX
constant methods toDynamic
. - โ Added
sin
,cos
andtan
forDecimal
values.
Decimal
Valuesparse_float()
,PI()
andE()
now defer toDecimal
underno_float
ifdecimal
is turned on.- โ Added
log10()
forDecimal
. ln
forDecimal
is now checked and won't panic.
String Values
SmartString
now usesLazyCompact
instead ofCompact
to minimize allocations.- โ Added
pop
for strings. - โ Added
ImmutableString::ptr_eq
to test if two strings point to the same allocation. - ๐ The
serde
feature ofSmartString
is turned on undermetadata
to makeMap
serializable.
Scope
APIScope::set_value
now takes anything that implementsInto<Cow<str> >
.- โ Added
Scope::is_constant
to check if a variable is constant. - Added
Scope::set_or_push
to add a new variable only if one doesn't already exist.
AST
API- โ Added
ASTNode::position
. - ๐
ReturnType
is removed in favor of option flags forStmt::Return
. - ๐
Stmt::Break
andStmt::Continue
are merged intoStmt::BreakLoop
via an option flag. StaticVec
is changed to keep three items inline instead of four.