summaryrefslogtreecommitdiffstats
path: root/runtime/doc/vim9.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-31 15:40:56 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-31 15:40:56 +0000
commitc4573eb12dba6a062af28ee0b8938d1521934ce4 (patch)
tree45dead4c82bacf905972ddaddb20d6c15cbf7ca4 /runtime/doc/vim9.txt
parent424bcae1fb0f69e0aef5e0cf84fd771cf34a0fb7 (diff)
Update runtime files
Diffstat (limited to 'runtime/doc/vim9.txt')
-rw-r--r--runtime/doc/vim9.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 2baf46c599..06f89255ce 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 8.2. Last change: 2022 Jan 29
+*vim9.txt* For Vim version 8.2. Last change: 2022 Jan 30
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -372,13 +372,12 @@ Global variables must be prefixed with "g:", also at the script level. >
g:global = 'value'
var Funcref = g:ThatFunction
-Global functions must be prefixed with "g:" when defining them, but can be
-called without "g:". >
+Global functions must be prefixed with "g:": >
vim9script
def g:GlobalFunc(): string
return 'text'
enddef
- echo GlobalFunc()
+ echo g:GlobalFunc()
The "g:" prefix is not needed for auto-load functions.
*vim9-function-defined-later*
@@ -1334,10 +1333,10 @@ variable was declared in a legacy function.
When a type has been declared this is attached to a list or string. When
later some expression attempts to change the type an error will be given: >
var ll: list<number> = [1, 2, 3]
- ll->extend('x') # Error, 'x' is not a number
+ ll->extend(['x']) # Error, 'x' is not a number
If the type is inferred then the type is allowed to change: >
- [1, 2, 3]->extend('x') # result: [1, 2, 3, 'x']
+ [1, 2, 3]->extend(['x']) # result: [1, 2, 3, 'x']
Stricter type checking ~