Releases: rhaiscript/rhai
Releases · rhaiscript/rhai
v1.1.1
Bug fixes
- Assignment to indexing expression with dot expressions inside no longer cause a compilation error.
- The
no_module
andinternals
features now work together without a compilation error. - String literal operations (such as
"hello" + ", world"
) now optimizes correctly.
v1.1.0
Version 1.1.0
released to crates.io
.
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
API
Engine::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
Values
Dynamic::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
Values
parse_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
API
Scope::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.
v1.0.6
Bug fixes
- Eliminate unnecessary property write-back when accessed via a getter since property getters are assumed to be pure.
- Writing to a property of an indexed valued obtained via an indexer now works properly by writing back the changed value via an index setter.
Enhancements
MultiInputsStream
,ParseState
,TokenIterator
,IdentifierBuilder
andAccessMode
are exported under theinternals
feature.
v1.0.5
v1.0.4
v1.0.2
v1.0.1
v1.0.0
The official version 1.0
.
Almost the same version as 0.20.3
but with deprecated API's removed.
Version 1.0.0
released to crates.io
.
Bug fixes
- Fixed infinite loop in certain script optimizations.
- Building for
no-std
no longer requires patchingsmartstring
. - Parsing a lone
return
orthrow
without a semicolon at the end of a block no longer raises an error.
Breaking changes
- All deprecated API's (e.g. the
RegisterFn
andRegisterResultFn
traits) are removed. Module::set_id
is split intoModule::set_id
andModule::clear_id
pair.begin
,end
,each
,then
,unless
are no longer reserved keywords.
Enhancements
- New methods
is_odd
,is_even
for integers, andis_zero
for all numbers. From<BTreeSet>
andFrom<HashSet>
are added forDynamic
, which create object maps with()
values.
v0.20.3
This version adds support to index into an integer number, treating it as a bit-field.
Version 0.20.3
released to crates.io
.
Bug fixes
- Fixed incorrect optimization regarding chain-indexing with non-numeric index.
- Variable values are checked for over-sized violations after assignments and setters.
Breaking changes
- To keep the API consistent, strings are no longer iterable by default. Use the
chars
method to iterate through the characters in a string. Dynamic::take_string
andDynamic::take_immutable_string
are renamed toDynamic::as_string
andDynamic::as_immutable_string
respectively.
New features
- New syntax for
for
statement to include counter variable. - An integer value can now be indexed to get/set a single bit.
- The
bits
method of an integer can be used to iterate through its bits. - New
$bool$
,$int$
,$float$
and$string$
expression types for custom syntax. - New methods
to_hex
,to_octal
andto_binary
for integer numbers. - New methods
to_upper
,to_lower
,make_upper
,make_lower
for strings/characters.
v0.20.2
This version adds a number of convenience features:
-
Ability for a
Dynamic
to hold ani32
tag of arbitrary data -
Simplifies dynamic properties access by falling back to an indexer (passing the name of the property as a string) when a property is not found.
Version 0.20.2
released to crates.io
.
Bug fixes
- Propagation of constants held in a custom scope now works properly instead of always replacing by
()
.
Breaking changes
Engine::disable_doc_comments
is removed because doc-comments are now placed under themetadata
feature flag.- Registering a custom syntax now only requires specifying whether the
Scope
is adjusted (i.e. whether variables are added or removed). There is no need to specify the number of variables added/removed. - Assigning to a property of a constant is now allowed and no longer raise an
EvalAltResult::ErrorAssignmentToConstant
error. This is to facilitate the Singleton pattern. Registered setter functions are automatically guarded against setters calling on constants and will continue to raise errors unless thepure
attribute is present (for plugins). - If a property getter/setter is not found, an indexer with string index, if any, is tried.
- The indexers API (
Engine::register_indexer_XXX
andModule::set_indexer_XXX
) are now also exposed underno_index
.
New features
- Each
Dynamic
value can now contain arbitrary data (typei32
) in the form of a tag. This is to use up otherwise wasted space in theDynamic
type. - A new internal feature
no_smartstring
to turn offSmartString
for those rare cases that it is needed. DynamicReadLock
andDynamicWriteLoc
are exposed underinternals
.From<Shared<Locked<Dynamic>>>
is added forDynamic
mapping directly to a shared value, together with support forDynamic::from
.- An indexer with string index acts as a fallback to a property getter/setter.
Enhancements
- Registering a custom syntax now only requires specifying whether the
Scope
is adjusted (i.e. whether variables are added or removed). This allows more flexibility for cases where the number of new variables declared depends on internal logic. - Putting a
pure
attribute on a plugin property/index setter now enables it to be used on constants.