Add docs for auto-currying.

This commit is contained in:
Stephen Chung
2020-07-29 22:43:57 +08:00
parent 1465ba2315
commit 8299adf95c
10 changed files with 178 additions and 80 deletions

View File

@@ -49,9 +49,13 @@ fn anon_fn_1001(x) { this.data -= x; }
fn anon_fn_1002() { print this.data; }
```
WARNING - NOT Closures
----------------------
Remember: anonymous functions, though having the same syntax as Rust _closures_, are themselves
**not** closures. In particular, they do not capture their running environment. They are more like
Rust's function pointers.
They do, however, _capture_ variable _values_ from their execution environment, unless the [`no_capture`]
feature is turned on. This is accomplished via [automatic currying][capture].