Skip to content

v1.7.0

Compare
Choose a tag to compare
@schungx schungx released this 04 May 01:24
· 1249 commits to main since this release
4fff1d8

This release is primarily minor functionality and API enhancements.

Bug fixes

  • Compound assignments now work properly with indexers.
  • Cloning a Scope no longer turns all constants to mutable.

Script-breaking changes

  • Strict Variables Mode no longer returns an error when an undeclared variable matches a variable/constant in the provided external Scope.

Potentially breaking API changes

  • The Engine::on_var and Engine::on_parse_token API's are now marked unstable/volatile.
  • The closures passed to Engine::on_var, Engine::on_def_var and Engine::register_debugger take EvalContext instead of &EvalContext or &mut EvalContext.
  • The following enum's are marked non_exhaustive: AccessMode, FnAccess, FnNamespace, FnMetadata, OptimizationLevel

New API

  • Module::eval_ast_as_new_raw is made public as a low-level API.
  • format_map_as_json is provided globally, which is the same as to_json for object maps.
  • Engine::call_fn_raw_raw is added to add speed to repeated function calls.
  • Engine::eval_statements_raw is added to evaluate a sequence of statements.

New features

  • A custom state is provided that is persistent during the entire evaluation run. This custom state is a Dynamic, which can hold any data, and can be accessed by the host via EvalContext::tag, EvalContext::tag_mut, NativeCallContext::tag and GlobalRuntimeState.tag.

Enhancements

  • Improper switch case condition syntax is now caught at parse time.
  • Engine::parse_json now natively handles nested JSON inputs (using a token remap filter) without needing to replace { with #{.
  • to_json is added to object maps to cheaply convert it to JSON format (() is mapped to null, all other data types must be supported by JSON)
  • FileModuleResolver now accepts a custom Scope to provide constants for optimization.
  • New variants, Start and End, are added to DebuggerEvent triggered at the start/end of script evaluation.