summaryrefslogtreecommitdiffstats
path: root/runtime/doc/builtin.txt
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-03-03 16:26:58 +0100
committerChristian Brabandt <cb@256bit.org>2024-03-03 16:34:51 +0100
commitd3eae7bc116297f70220f21ded436ed0a88066d8 (patch)
tree29837ff70cabc4f3238be13df845dcb6ace10da9 /runtime/doc/builtin.txt
parent215703563757a4464907ead6fb9edaeb7f430bea (diff)
patch 9.1.0148: Vim9: can't call internal methods with objectsv9.1.0148
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>
Diffstat (limited to 'runtime/doc/builtin.txt')
-rw-r--r--runtime/doc/builtin.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index dbad8802e1..0d47e36531 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1,4 +1,4 @@
-*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 01
+*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2265,6 +2265,8 @@ empty({expr}) *empty()*
- A |Job| is empty when it failed to start.
- A |Channel| is empty when it is closed.
- A |Blob| is empty when its length is zero.
+ - An |Object| is empty, when the |empty()| builtin method in
+ the object (if present) returns true.
For a long |List| this is much faster than comparing the
length with zero.
@@ -5476,7 +5478,9 @@ len({expr}) The result is a Number, which is the length of the argument.
When {expr} is a |Blob| the number of bytes is returned.
When {expr} is a |Dictionary| the number of entries in the
|Dictionary| is returned.
- Otherwise an error is given and returns zero.
+ When {expr} is an |Object|, invokes the |len()| method in the
+ object (if present) to get the length. Otherwise returns
+ zero.
Can also be used as a |method|: >
mylist->len()
@@ -9587,6 +9591,10 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
replaced by "[...]" or "{...}". Using eval() on the result
will then fail.
+ For an object, invokes the |string()| method to get a textual
+ representation of the object. If the method is not present,
+ then the default representation is used.
+
Can also be used as a |method|: >
mylist->string()