Skip to content

Releases: rhaiscript/rhai

v1.0.6

28 Sep 08:50
8c15e2b
Compare
Choose a tag to compare

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 and AccessMode are exported under the internals feature.

v1.0.5

19 Sep 14:30
4ed757d
Compare
Choose a tag to compare

This is a bug fix version with the following fixes:

  • FloatWrapper is no longer erroneously exported under no_float+internals.
  • The sign function now works properly for float values that are NaN.

v1.0.4

03 Sep 02:16
5cc1fd1
Compare
Choose a tag to compare

Fixed bug with catch variable used in catch block.

This release fixes a bug in 1.0.3 which has been yanked.

v1.0.2

17 Aug 07:49
e4c2637
Compare
Choose a tag to compare

Fixed bug in method call followed by an array indexing.

v1.0.1

06 Aug 07:29
b3a1c12
Compare
Choose a tag to compare

Bug fixes

  • Fixed bug in using indexing/dotting inside index bracket.
  • while and loop statements are no longer considered pure (since a loop can go on forever and this is a side effect).

v1.0.0

07 Jul 01:03
51a9c55
Compare
Choose a tag to compare

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 patching smartstring.
  • Parsing a lone return or throw without a semicolon at the end of a block no longer raises an error.

Breaking changes

  • All deprecated API's (e.g. the RegisterFn and RegisterResultFn traits) are removed.
  • Module::set_id is split into Module::set_id and Module::clear_id pair.
  • begin, end, each, then, unless are no longer reserved keywords.

Enhancements

  • New methods is_odd, is_even for integers, and is_zero for all numbers.
  • From<BTreeSet> and From<HashSet> are added for Dynamic, which create object maps with () values.

v0.20.3

22 Jun 14:46
6006942
Compare
Choose a tag to compare

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 and Dynamic::take_immutable_string are renamed to Dynamic::as_string and Dynamic::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 and to_binary for integer numbers.
  • New methods to_upper, to_lower, make_upper, make_lower for strings/characters.

v0.20.2

26 May 09:35
9a54fd6
Compare
Choose a tag to compare

This version adds a number of convenience features:

  • Ability for a Dynamic to hold an i32 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 the metadata 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 the pure 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 and Module::set_indexer_XXX) are now also exposed under no_index.

New features

  • Each Dynamic value can now contain arbitrary data (type i32) in the form of a tag. This is to use up otherwise wasted space in the Dynamic type.
  • A new internal feature no_smartstring to turn off SmartString for those rare cases that it is needed.
  • DynamicReadLock and DynamicWriteLoc are exposed under internals.
  • From<Shared<Locked<Dynamic>>> is added for Dynamic mapping directly to a shared value, together with support for Dynamic::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.

v0.20.1

02 May 12:35
ee6c11e
Compare
Choose a tag to compare

This version enables functions to access constants declared at global level via the special global module.

Version 0.20.1 released to crates.io.

Bug fixes

  • Fixed bug when position is zero in insert and split_at methods for arrays.
  • Indexing operations with pure index values are no longer considered pure due to the possibility of indexers.

Breaking changes

  • Dynamic::is_shared and Dynamic::is_locked are removed under the no_closure feature. They used to always return false.
  • Engine::call_fn now evaluates the AST before calling the function.
  • Engine::on_progress is disabled with unchecked.

New features

  • A module called global is automatically created to hold global-level constants, which can then be accessed from functions.
  • A new feature no_position is added to turn off position tracking during parsing to squeeze out the last drop of performance.

Enhancements

  • The crate no-std-compat is used to compile for no-std. This removes the need to use a special crate::stdlib namespace for std imports.

v0.20.0

16 Apr 14:29
Compare
Choose a tag to compare

This version adds string interpolation with `... ${ ... } ...` syntax.

switch statement cases can now have conditions.

Negative indices for arrays and strings are allowed and now count from the end (-1 = last item/character).

Version 0.20.0 released to crates.io.

Bug fixes

  • Property setter op-assignments now work properly.
  • Off-by-one bug in Array::drain method with range is fixed.

Breaking changes

  • Negative index to an array or string yields the appropriate element/character counting from the end.
  • The default _ case of a switch statement now must be the last case, together with two new error variants: EvalAltResult::WrongSwitchDefaultCase and EvalAltResult::WrongSwitchCaseCondition.
  • ModuleResolver trait methods take an additional parameter source_path that contains the path of the current environment. This is to facilitate loading other script files always from the current directory.
  • FileModuleResolver now resolves relative paths under the source path if there is no base path set.
  • FileModuleResolver::base_path now returns Option<&str> which is None if there is no base path set.
  • Doc-comments now require the metadata feature.

Enhancements

  • Array::drain and Array::retain methods with predicate now scan the array in forward order instead of in reverse.

New features

  • String interpolation support is added via the `... ${ ... } ...` syntax.
  • FileModuleResolver resolves relative paths under the parent path (i.e. the path holding the script that does the loading). This allows seamless cross-loading of scripts from a directory hierarchy instead of having all relative paths load from the current working directory.
  • Negative index to an array or string yields the appropriate element/character counting from the end.
  • switch statement cases can now have an optional if clause.