summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-09 23:25:08 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-09 23:25:08 +0200
commit22a0c0c4ecd23b6c43f79ba9b92899ca0b426e29 (patch)
tree4c2ad3650de93bd7282b196205e862f4c23ce8ba /runtime
parent0c779e8e4831c538918ae835ce3365af028e36ea (diff)
patch 8.1.1834: cannot use a lambda as a methodv8.1.1834
Problem: Cannot use a lambda as a method. Solution: Implement ->{lambda}(). (closes #4768)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 2f35c7c992..981121f8a1 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1217,7 +1217,8 @@ expr8(expr1, ...) |Funcref| function call
When expr8 is a |Funcref| type variable, invoke the function it refers to.
-expr8->name([args]) method call *method*
+expr8->name([args]) method call *method* *->*
+expr8->{lambda}([args])
For methods that are also available as global functions this is the same as: >
name(expr8 [, args])
@@ -1227,6 +1228,9 @@ This allows for chaining, passing the value that one method returns to the
next method: >
mylist->filter(filterexpr)->map(mapexpr)->sort()->join()
<
+Example of using a lambda: >
+ GetPercentage->{x -> x * 100}()->printf('%d%%')
+
*E274*
"->name(" must not contain white space. There can be white space before the
"->" and after the "(", thus you can split the lines like this: >