Skip to content

v0.20.0

Compare
Choose a tag to compare
@schungx schungx released this 16 Apr 14:29

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.