mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.1.1834: cannot use a lambda as a method
Problem: Cannot use a lambda as a method. Solution: Implement ->{lambda}(). (closes #4768)
This commit is contained in:
@@ -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: >
|
||||
|
Reference in New Issue
Block a user