|
1 | | -*vim9.txt* For Vim version 8.2. Last change: 2020 Mar 01 |
| 1 | +*vim9.txt* For Vim version 8.2. Last change: 2020 Apr 03 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -249,8 +249,8 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE |
249 | 249 | the function follows in the next lines, until the |
250 | 250 | matching `:enddef`. |
251 | 251 |
|
252 | | - When {return-type} is omitted the function is not |
253 | | - expected to return anything. |
| 252 | + When {return-type} is omitted or is "void" the |
| 253 | + function is not expected to return anything. |
254 | 254 |
|
255 | 255 | {arguments} is a sequence of zero or more argument |
256 | 256 | declarations. There are three forms: |
@@ -296,29 +296,40 @@ The following builtin types are supported: |
296 | 296 | float |
297 | 297 | string |
298 | 298 | blob |
299 | | - list<type> |
300 | | - dict<type> |
301 | | - (a: type, b: type): type |
| 299 | + list<{type}> |
| 300 | + dict<{type}> |
302 | 301 | job |
303 | 302 | channel |
304 | 303 | func |
305 | | - partial |
| 304 | + func({type}, ...) |
| 305 | + func({type}, ...): {type} |
306 | 306 |
|
307 | 307 | Not supported yet: |
308 | | - tuple<a: type, b: type, ...> |
| 308 | + tuple<a: {type}, b: {type}, ...> |
309 | 309 |
|
310 | | -These types can be used in declarations, but no variable will have this type: |
311 | | - type|type |
| 310 | +These types can be used in declarations, but no value will have this type: |
| 311 | + {type}|{type} |
312 | 312 | void |
313 | 313 | any |
314 | 314 |
|
315 | | -There is no array type, use list<type> instead. For a list constant an |
| 315 | +There is no array type, use list<{type}> instead. For a list constant an |
316 | 316 | efficient implementation is used that avoids allocating lot of small pieces of |
317 | 317 | memory. |
318 | 318 |
|
319 | | -A function defined with `:def` must declare the return type. If there is no |
320 | | -type then the function doesn't return anything. "void" is used in type |
321 | | -declarations. |
| 319 | +A partial and function can be declared in more or less specific ways: |
| 320 | +func any kind of function reference, no type |
| 321 | + checking |
| 322 | +func: {type} any number and type of arguments with specific |
| 323 | + return type |
| 324 | +func({type} ...) function with argument types, does not return |
| 325 | + a value |
| 326 | +func({type} ...): {type} function with argument types and return type |
| 327 | + |
| 328 | +If the return type is "void" the function does not return a value. |
| 329 | + |
| 330 | +The reference can also be a |Partial|, in which case it stores extra arguments |
| 331 | +and/or a dictionary, which are not visible to the caller. Since they are |
| 332 | +called in the same way the declaration is the same. |
322 | 333 |
|
323 | 334 | Custom types can be defined with `:type`: > |
324 | 335 | :type MyList list<string> |
|
0 commit comments