diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-22 20:43:36 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-22 20:43:36 +0000 |
commit | afa048f0d4b5d63f2192c9ba340a9eb8b0822985 (patch) | |
tree | 1ee615badc0dc451a01bbe90a887c3d4460dd2d9 /runtime/doc/vim9.txt | |
parent | fe73255c92b6cb54851f82fa32458340b736298d (diff) |
patch 8.2.4447: Vim9: can still use s:var in a compiled functionv8.2.4447
Problem: Vim9: can still use s:var in a compiled function.
Solution: Disallow using s:var for Vim9 script. (closes #9824)
Diffstat (limited to 'runtime/doc/vim9.txt')
-rw-r--r-- | runtime/doc/vim9.txt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 987495a326..a5bcb3f443 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 Feb 18 +*vim9.txt* For Vim version 8.2. Last change: 2022 Feb 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -245,9 +245,11 @@ that the name interferes with builtin functions. *vim9-s-namespace* The use of the "s:" prefix is not supported at the Vim9 script level. All functions and variables without a prefix are script-local. -In :def functions the use of "s:" is optional. This is because in legacy -script the "s:" might be needed. Disallowing the use of "s:" only in a :def -function in Vim9 script would be a bit confusing. + +In :def functions the use of "s:" depends on the script: Script-local +variables and functions in a legacy script do use "s:", while in a Vim9 script +they do not use "s:". This matches what you see in the rest of the file. + In legacy functions the use of "s:" for script items is required, as before. In all cases the function must be defined before used. That is when it is @@ -1467,7 +1469,7 @@ strings: > # typename(mylist) == "list<string>", no error There is a subtle difference between using a list constant directly and -through a variable declaraiton. Because of type inference, when using a list +through a variable declaration. Because of type inference, when using a list constant to initialize a variable, this also sets the declared type: > var mylist = [1, 2, 3] # typename(mylist) == "list<number>" |