Mercurial > vim
diff runtime/doc/eval.txt @ 17674:06c3e15ad84d v8.1.1834
patch 8.1.1834: cannot use a lambda as a method
commit https://github.com/vim/vim/commit/22a0c0c4ecd23b6c43f79ba9b92899ca0b426e29
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 9 23:25:08 2019 +0200
patch 8.1.1834: cannot use a lambda as a method
Problem: Cannot use a lambda as a method.
Solution: Implement ->{lambda}(). (closes https://github.com/vim/vim/issues/4768)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 09 Aug 2019 23:30:05 +0200 |
parents | 95c23e180022 |
children | 14ac8c31e598 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1217,7 +1217,8 @@ expr8(expr1, ...) |Funcref| function cal 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 va 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: >