All Versions
60
Latest Version
Avg Release Cycle
54 days
Latest Release
-

Changelog History
Page 2

  • v1.5.0 Changes

    This version adds a debugging interface, which can be used to integrate a debugger.

    0๏ธโƒฃ Based on popular demand, an option is added to throw exceptions when invalid properties are accessed on object maps (default is to return ()).

    Also based on popular demand, the REPL tool now uses a slightly-enhanced version of rustyline for line editing and history.

    ๐Ÿ› Bug fixes

    • ๐Ÿ‘ฏ In Scope::clone_visible, constants are now properly cloned as constants.
    • ๐Ÿ‘ป Variables introduced inside try blocks are now properly cleaned up upon an exception.
    • ๐Ÿ›  Off-by-one error in character positions after a comment line is now fixed.
    • Globally-defined constants are now encapsulated correctly inside a loaded module and no longer spill across call boundaries.
    • ๐Ÿ›  Type names display is fixed.
    • Exceptions thrown inside function calls now unwrap correctly when catch-ed.
    • ๐Ÿ›  Error messages for certain invalid property accesses are fixed.

    Script-breaking changes

    • For consistency with the import statement, the export statement no longer exports multiple variables.
    • Appending a BLOB to a string (via +, +=, append or string interpolation) now treats the BLOB as a UTF-8 encoded string.
    • Appending a string/character to a BLOB (via += or append) now adds the string/character as a UTF-8 encoded byte stream.

    ๐Ÿ†• New features

    • A debugging interface is added.
    • A new bin tool, rhai-dbg (aka The Rhai Debugger), is added to showcase the debugging interface.
    • ๐Ÿ“ฆ A new package, DebuggingPackage, is added which contains the back_trace function to get the current call stack anywhere in a script.
    • Engine::set_fail_on_invalid_map_property is added to control whether to raise an error (new EvalAltResult::ErrorPropertyNotFound) when invalid properties are accessed on object maps.
    • ๐Ÿ‘ Engine::set_allow_shadowing is added to allow/disallow variables shadowing, with new errors EvalAltResult::ErrorVariableExists and ParseErrorType::VariableExists.
    • Engine::on_def_var allows registering a closure which can decide whether a variable definition is allow to continue, during compilation or runtime, or should fail with an error (ParseErrorType::ForbiddenVariable or EvalAltResult::ErrorForbiddenVariable).
    • ๐Ÿ“ฆ A new syntax for defining custom packages is introduced that removes the need to specify the Rhai crate name (internally uses the $crate meta variable).

    โœจ Enhancements

    • 0๏ธโƒฃ Default features for dependencies (such as ahash/std and num-traits/std) are no longer required.
    • The no_module feature now eliminates large sections of code via feature gates.
    • Debug display of AST is improved.
    • NativeCallContext::call_level() is added to give the current nesting level of function calls.
    • A new feature, bin-features, pulls in all the required features for bin tools.
    • AST position display is improved:
      • Expr::start_position is added to give the beginning of the expression (not the operator's position).
      • StmtBlock and Stmt::Block now keep the position of the closing } as well.
    • EvalAltResult::unwrap_inner is added to access the base error inside multiple layers of wrappings (e.g. EvalAltResult::ErrorInFunction).
    • ๐Ÿ“ฆ Yet another new syntax is introduced for def_package! that further simplifies the old syntax.
    • A new method to_blob is added to convert a string into a BLOB as UTF-8 encoded bytes.
    • A new method to_array is added to convert a BLOB into array of integers.

    REPL tool changes

    The REPL bin tool, rhai-rpl, has been enhanced.

    ๐Ÿ— Build changes

    • ๐Ÿ— The rustyline feature is now required in order to build rhai-repl.
    • ๐Ÿ— Therefore, rhai-repl is no longer automatically built when using a simple cargo build with default features.

    Line editor

    • rhai-repl now uses a modified version of rustyline as a line editor with history.
    • Ctrl-Enter can now be used to enter multiple lines without having to attach the \ continuation character the end of each line.
    • ๐Ÿ Bracketed paste is supported, even on Windows (version 10 or above), so pasting code directly into rhai-repl is made much more convenient.

    ๐Ÿ†• New commands

    • strict to turn on/off Strict Variables Mode.
    • โšก๏ธ optimize to turn on/off script optimization.
    • ๐Ÿ–จ history to print lines history.
    • !!, !num, !text and !?text to recall a history line.
    • ๐Ÿ–จ keys to print all key bindings.
  • v1.4.1 Changes

    ๐Ÿ›  This is primarily a bug-fix version which fixes a large number of bugs.

    ๐Ÿ› Bug fixes

    • Expressions such as x = x + 1 no longer panics.
    • Padding arrays with another array via pad no longer loops indefinitely.
    • chop for arrays and BLOB's now works properly.
    • set_bit for bit-flags with negative index now works correctly.
    • Misnamed params field name in the JSON output of Engine::gen_fn_metadata_to_json is fixed (was incorrectly named type).
    • ๐Ÿ›  Fixes a potential unsafe violation in for loop.
    • Missing to_hex, to_octal and to_binary for i128 and u128 are added.
    • ๐Ÿšš remove for arrays and BLOB's now treat negative index correctly.
    • ๐Ÿ“œ parse_int now works properly for negative numbers.
    • Engine::gen_fn_signatures now generates signatures for external packages registered via Engine::register_global_module.
    • \r\n pairs are now recognized correctly for doc-comments.

    โœจ Enhancements

    • ๐Ÿ“‡ Formatting of return types in functions metadata info is improved.
    • ๐Ÿšš Use SmartString for Scope variable names and remove unsafe lifetime casting.
    • Functions in the standard library now have doc-comments (which can be obtained via Engine::gen_fn_metadata_to_json).
    • get and set methods are added to arrays, BLOB's, object maps and strings.
  • v1.4.0 Changes

    This version adds support for integer ranges via the .. and ..= operators. Many standard API's are extended with range parameters where appropriate.

    Script-breaking changes

    • is is (pun intended) now a reserved keyword to prepare for possible future type checking expressions (e.g. x is "string").

    ๐Ÿ’ฅ Breaking changes

    • ๐Ÿ“ฆ LogicPackage is removed from CorePackage.
    • ๐Ÿ“ฆ Bit-field functions are moved into a new BitFieldPackage (used to be in LogicPackage) which makes more sense.

    ๐Ÿ› Bug fixes

    • Custom syntax now works properly inside binary expressions and with method calls.
    • ๐Ÿ“œ Hex numbers with the high-bit set now parse correctly into negative integer numbers.
    • Constructing a literal array or object map now checks for size limits for each item instead of at the very end when it is already too late.
    • Non-INT integer types are now treated exactly as custom types under only_i64 and only_i32.
    • Calling pad on an array now checks for total size over limit after each item added.

    ๐Ÿ†• New features

    • Added support for integer ranges via the .. and ..= operators.
    • โž• Added EvalAltResult::ErrorCustomSyntax to catch errors in custom syntax, which should not happen unless an AST is compiled on one Engine but evaluated on another unrelated Engine.

    โœจ Enhancements

    • BLOB's are refined to display in a more compact hex format.
    • ๐Ÿ“ฆ A new syntax is introduced for def_package! that will replace the old syntax in future versions.
    • โž• Added NativeCallContext::call_fn to easily call a function.
    • ๐Ÿ“‡ Doc-comments on plugin module functions are extracted into the functions' metadata.

    ๐Ÿ—„ Deprecated API's

    • Expression::get_variable_name is deprecated in favor of the new Expression::get_string_value.
    • ๐Ÿ“ฆ The old syntax of def_package! is deprecated in favor of the new syntax.
  • v1.3.0 Changes

    ๐Ÿ”ง This version adds native support for BLOB's (byte arrays), as well as a number of configuration settings to fine-tun language features.

    Compiler requirement

    • Minimum compiler version is now 1.51.

    ๐Ÿ› Bug fixes

    • ๐Ÿ‘ from_dynamic now supports deserializing Option.

    ๐Ÿ†• New features

    • ๐Ÿ‘ BLOB (essentially a byte array) is added as a supported primitive value type parallel to arrays.
    • ๐Ÿ†• New options for Engine which allows disabling if-expressions, switch-expressions, statement expressions, anonymous functions and/or looping (i.e. while, loop, do and for statements):
      • Engine::set_allow_if_expression
      • Engine::set_allow_switch_expression
      • Engine::set_allow_statement_expression
      • Engine::set_allow_anonymous_fn
      • Engine::set_allow_looping
    • New strict variables mode for Engine (enabled via Engine::set_strict_variables) to throw parse errors on undefined variable usage. Two new parse error variants, ParseErrorType::VariableNotFound and ParseErrorType::ModuleNotFound, are added.

    โœจ Enhancements

    • Two double quotes ("") in a string literal now maps to "; two back-ticks (``) in a literal string now maps to `.
    • Added Engine::register_type_with_name_raw to register a custom type based on a fully-qualified type path.
    • Added into_array and into_typed_array for Dynamic.
    • Added FnPtr::call and FnPtr::call_within_context to simplify calling a function pointer.
    • ๐Ÿ“‡ A function's hashes are included in its JSON metadata to assist in debugging. Each function's baseHash field in the JSON object should map directly to the pre-calculated hash in the function call.
    • Expression now derefs to Expr.

    ๐Ÿ—„ Deprecated and Gated API's

    • ๐Ÿ—„ NativeCallContext::new is deprecated because it is simpler to call a function pointer via FnPtr::call.
    • AST::merge_filtered and AST::combine_filtered are no longer exported under no_function.
    • AST::new and AST::new_with_source are moved under internals.
    • ๐Ÿ—„ FnPtr::call_dynamic is deprecated in favor of FnPtr::call_raw.
  • v1.2.1 Changes

    ๐Ÿ› Bug fixes

    • Array methods (such as map) taking a closure with captures as argument now works properly.
  • v1.2.0 Changes

    ๐Ÿ› Bug fixes (potentially script-breaking)

    • As originally intended, function calls with a bang (!) now operates directly on the caller's scope, allowing variables inside the scope to be mutated.
    • As originally intended, Engine::XXX_with_scope API's now properly propagate constants within the provided scope also to functions in the script.
    • ๐Ÿ–จ Printing of integral floating-point numbers is fixed (used to only prints 0.0).
    • func!() calls now work properly under no_closure.
    • ๐Ÿ›  Fixed parsing of unary negation such that expressions like if foo { ... } -x parses correctly.

    ๐Ÿ†• New features

    • ๐Ÿ”Œ #[cfg(...)] attributes can now be put directly on plugin functions or function defined in a plugin module.
    • ๐Ÿ“œ A custom syntax parser can now return a symbol starting with $$ to inform the implementation function which syntax variant was actually parsed.
    • AST::iter_literal_variables is added to extract all top-level literal constant/variable definitions from a script without running it.
    • Engine::call_fn_dynamic is deprecated and Engine::call_fn_raw is added which allows keeping new variables in the custom scope.

    โœจ Enhancements

    • Array methods now avoid cloning as much as possible (although most predicates will involve cloning anyway if passed a closure).
    • Array methods that take function pointers (e.g. closures) now optionally take the function name as a string.
    • Array adds the dedup method.
    • Array adds a sort method with no parameters which sorts homogeneous arrays of built-in comparable types (e.g. INT).
    • Inlining is disabled for error-path functions because errors are exceptional and scripts usually fail completely when an error is encountered.
    • โšก๏ธ The optimize module is completely eliminated under no_optimize, which should yield smaller code size.
    • NativeCallContext::position is added to return the position of the function call.
    • ๐Ÿ‘ฏ Scope::clone_visible is added that copies only the last instance of each variable, omitting all shadowed variables.

    ๐Ÿ—„ Deprecated API's

    • NativeCallContext::call_fn_dynamic_raw is deprecated and NativeCallContext::call_fn_raw is added.
    • ๐Ÿ—„ From<EvalAltResult> for Result<T, Box<EvalAltResult> > is deprecated so it will no longer be possible to do EvalAltResult::ErrorXXXXX.into() to convert to a Result; instead, Err(EvalAltResult:ErrorXXXXX.into()) must be used. Code is clearer if errors are explicitly wrapped in Err.
  • v1.1.2 Changes

    ๐Ÿ› Bug fixes

    • ๐Ÿ–จ 0.0 now prints correctly (used to print 0e0).
    • Unary operators are now properly recognized as an expression statement.
    • Reverses a regression on string + operations.
    • ๐Ÿ“ฆ The global namespace is now searched before packages, which is the correct behavior.
  • v1.1.1 Changes

    ๐Ÿ› Bug fixes

    • Assignment to indexing expression with dot expressions inside no longer cause a compilation error.
    • The no_module and internals features now work together without a compilation error.
    • โšก๏ธ String literal operations (such as "hello" + ", world") now optimizes correctly.
  • v1.1.0 Changes

    ๐Ÿ› 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 to Engine::run_XXX to make meanings clearer. The consume_XXX API is deprecated.
    • Engine::register_type_XXX are now available even under no_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 and Dynamic::as_immutable_string are deprecated and replaced by into_string and into_immutable_string respectively.
    • โž• Added a number of constants to Dynamic.
    • โž• Added a number of constants and fromXXX constant methods to Dynamic.
    • โž• Added sin, cos and tan for Decimal values.

    Decimal Values

    • parse_float(), PI() and E() now defer to Decimal under no_float if decimal is turned on.
    • โž• Added log10() for Decimal.
    • ln for Decimal is now checked and won't panic.

    String Values

    • SmartString now uses LazyCompact instead of Compact to minimize allocations.
    • โž• Added pop for strings.
    • โž• Added ImmutableString::ptr_eq to test if two strings point to the same allocation.
    • ๐Ÿ“‡ The serde feature of SmartString is turned on under metadata to make Map serializable.

    Scope API

    • Scope::set_value now takes anything that implements Into<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 for Stmt::Return.
    • ๐Ÿ”€ Stmt::Break and Stmt::Continue are merged into Stmt::BreakLoop via an option flag.
    • StaticVec is changed to keep three items inline instead of four.
  • v1.0.6 Changes

    ๐Ÿ› 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.