Refine what can be called in method style.

This commit is contained in:
Stephen Chung
2022-12-27 22:06:51 +08:00
parent 7c00b74916
commit bb1136e8ad
6 changed files with 81 additions and 77 deletions

View File

@@ -11,6 +11,7 @@ Bug fixes
* Parsing deeply-nested closures (e.g. `||{||{||{||{||{||{||{...}}}}}}}`) no longer panics but will be confined to the nesting limit.
* Closures containing a single expression are now allowed in `Engine::eval_expression` etc.
* Strings interpolation now works under `Engine::new_raw` without any standard package.
* `Fn` now throws an error if the name is a reserved keyword as it cannot possibly map to such a function. This also disallows creating function pointers to custom operators which are defined as disabled keywords (a mouthful), but such custom operators are designed primarily to be used as operators.
Breaking API changes
--------------------
@@ -60,6 +61,7 @@ Net features
* Array methods that take a function pointer, usually a closure (e.g. `map`, `filter`, `index_of`, `reduce` etc.), can now bind the array element to `this` when calling a closure.
* This vastly improves performance when working with arrays of large types (e.g. object maps) by avoiding unnecessary cloning.
* `find` and `find_map` are added for arrays.
* `for_each` is also added for arrays, allowing a closure to mutate array elements (bound to `this`) in turn.
Enhancements
@@ -79,7 +81,6 @@ Enhancements
* `FnPtr::iter_curry` and `FnPtr::iter_curry_mut` are added.
* `Dynamic::deep_scan` is added to recursively scan for `Dynamic` values.
* `>>` and `<<` operators on integers no longer throw errors when the number of bits to shift is out of bounds. Shifting by a negative number of bits simply reverses the shift direction.
* `find` and `find_map` are added for arrays.
Version 1.11.0