Mercurial > vim
comparison runtime/doc/builtin.txt @ 34472:5c1a025192ed v9.1.0148
patch 9.1.0148: Vim9: can't call internal methods with objects
Commit: https://github.com/vim/vim/commit/d3eae7bc116297f70220f21ded436ed0a88066d8
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Mar 3 16:26:58 2024 +0100
patch 9.1.0148: Vim9: can't call internal methods with objects
Problem: Vim9: can't call internal methods with objects
Solution: Add support for empty(), len() and string() function
calls for objects (Yegappan Lakshmanan)
closes: #14129
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Mar 2024 16:45:06 +0100 |
parents | 4944acf6b46f |
children | 7cc0b2479fad |
comparison
equal
deleted
inserted
replaced
34471:7f6302969e3d | 34472:5c1a025192ed |
---|---|
1 *builtin.txt* For Vim version 9.1. Last change: 2024 Mar 01 | 1 *builtin.txt* For Vim version 9.1. Last change: 2024 Mar 03 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
2263 - A |Number| and |Float| are empty when their value is zero. | 2263 - A |Number| and |Float| are empty when their value is zero. |
2264 - |v:false|, |v:none| and |v:null| are empty, |v:true| is not. | 2264 - |v:false|, |v:none| and |v:null| are empty, |v:true| is not. |
2265 - A |Job| is empty when it failed to start. | 2265 - A |Job| is empty when it failed to start. |
2266 - A |Channel| is empty when it is closed. | 2266 - A |Channel| is empty when it is closed. |
2267 - A |Blob| is empty when its length is zero. | 2267 - A |Blob| is empty when its length is zero. |
2268 - An |Object| is empty, when the |empty()| builtin method in | |
2269 the object (if present) returns true. | |
2268 | 2270 |
2269 For a long |List| this is much faster than comparing the | 2271 For a long |List| this is much faster than comparing the |
2270 length with zero. | 2272 length with zero. |
2271 | 2273 |
2272 Can also be used as a |method|: > | 2274 Can also be used as a |method|: > |
5474 When {expr} is a |List| the number of items in the |List| is | 5476 When {expr} is a |List| the number of items in the |List| is |
5475 returned. | 5477 returned. |
5476 When {expr} is a |Blob| the number of bytes is returned. | 5478 When {expr} is a |Blob| the number of bytes is returned. |
5477 When {expr} is a |Dictionary| the number of entries in the | 5479 When {expr} is a |Dictionary| the number of entries in the |
5478 |Dictionary| is returned. | 5480 |Dictionary| is returned. |
5479 Otherwise an error is given and returns zero. | 5481 When {expr} is an |Object|, invokes the |len()| method in the |
5482 object (if present) to get the length. Otherwise returns | |
5483 zero. | |
5480 | 5484 |
5481 Can also be used as a |method|: > | 5485 Can also be used as a |method|: > |
5482 mylist->len() | 5486 mylist->len() |
5483 | 5487 |
5484 < *libcall()* *E364* *E368* | 5488 < *libcall()* *E364* *E368* |
9584 Object object of SomeName {lnum: 1, col: 3} | 9588 Object object of SomeName {lnum: 1, col: 3} |
9585 | 9589 |
9586 When a |List| or |Dictionary| has a recursive reference it is | 9590 When a |List| or |Dictionary| has a recursive reference it is |
9587 replaced by "[...]" or "{...}". Using eval() on the result | 9591 replaced by "[...]" or "{...}". Using eval() on the result |
9588 will then fail. | 9592 will then fail. |
9593 | |
9594 For an object, invokes the |string()| method to get a textual | |
9595 representation of the object. If the method is not present, | |
9596 then the default representation is used. | |
9589 | 9597 |
9590 Can also be used as a |method|: > | 9598 Can also be used as a |method|: > |
9591 mylist->string() | 9599 mylist->string() |
9592 | 9600 |
9593 < Also see |strtrans()|. | 9601 < Also see |strtrans()|. |