Repository navigation
v.0.18.1
Version 0.18.1 released to crates.io
This version adds:
- Anonymous functions (in Rust closure syntax). Simplifies creation of single-use ad-hoc functions.
- Currying of function pointers.
- Closures - auto-currying of anonymous functions to capture shared variables from the external scope. Use the
no_closurefeature to disable sharing values and capturing. - Binding the
thispointer in a function pointercall. - Capturing call scope via
func!(...)syntax.
New features
callcan now be called function-call style for function pointers - this is to handle builds withno_object.- Reserve language keywords, such as
print,eval,call,thisetc. x.call(f, ...)allows bindingxtothisfor the function referenced by the function pointerf.- Anonymous functions are supported in the syntax of a Rust closure, e.g.
|x, y, z| x + y - z. - Custom syntax now works even without the
internalsfeature. - Currying of function pointers is supported via the new
currykeyword. - Automatic currying of anonymous functions to capture shared variables from the external scope.
- Capturing of the calling scope for function call via the
func!(...)syntax. Module::set_indexer_get_set_fnis added as a shorthand of bothModule::set_indexer_get_fnandModule::set_indexer_set_fn.- New
unicode-xid-identfeature to allow Unicode Standard Annex #31 for identifiers. Scope::iter_rawreturns an iterator with a reference to the underlyingDynamicvalue (which may be shared).
Breaking changes
- Language keywords are now reserved (even when disabled) and they can no longer be used as variable names.
- Function signature for defining custom syntax is simplified.
Engine::register_raw_fn_XXXAPI shortcuts are removed.PackagesCollection::get_fn,PackagesCollection::contains_fn,Module::get_fnandModule::contains_fnnow take an additionalpublic_onlyparameter indicating whether only public functions are accepted.- The iterator returned by
Scope::iternow contains a clone of theDynamicvalue (unshared). Engine::load_packagetakes any type that isInto<PackageLibrary>.- Error in
Engine::register_custom_syntaxis no longerBox-ed.
Housekeeping
- Most compilation warnings are eliminated via feature gates.