Update runtime files
This commit is contained in:
@ -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 ~
|
||||
|
||||
Reference in New Issue
Block a user