summaryrefslogtreecommitdiffstats
path: root/runtime/doc/vim9.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/vim9.txt')
-rw-r--r--runtime/doc/vim9.txt28
1 files changed, 15 insertions, 13 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index b12b1cc..7dd2ab0 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 9.1. Last change: 2023 Dec 24
+*vim9.txt* For Vim version 9.1. Last change: 2024 Jan 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1260,10 +1260,12 @@ Script-local variables in a |Vim9| script must be declared at the script
level. They cannot be created in a function, also not in a legacy function.
*:defc* *:defcompile*
-:defc[ompile] Compile functions defined in the current script that
- were not compiled yet.
- This will report any errors found during compilation.
- This excludes functions defined inside a class.
+:defc[ompile] Compile functions and classes (|class-compile|)
+ defined in the current script that were not compiled
+ yet. This will report any errors found during
+ compilation.
+
+:defc[ompile] MyClass Compile all methods in a class. |class-compile|
:defc[ompile] {func}
:defc[ompile] debug {func}
@@ -1718,8 +1720,8 @@ an example for each category: >
Vim does not have a familiar null value; it has various null_<type> predefined
values, for example |null_string|, |null_list|, |null_job|. Primitives do not
have a null_<type>. The typical use cases for null_<type> are:
-- to `clear a variable` and release its resources;
-- as a `default for a parameter` in a function definition, see |null-compare|.
+- to clear a variable and release its resources;
+- as a default for a parameter in a function definition, see |null-compare|.
For a specialized variable, like `job`, null_<type> is used to clear the
resources. For a container variable, resources can also be cleared by
@@ -1771,7 +1773,7 @@ an empty container, do not use null_<type> in a comparison: >
F(null_list) # output: "null"
F([]) # output: "not null, empty"
F(['']) # output: "not null, not empty"
-The above function takes a `list of strings` and reports on it.
+The above function takes a list of strings and reports on it.
Change the above function signature to accept different types of arguments: >
def F(arg: list<any> = null_list) # any type of list
def F(arg: any = null) # any type
@@ -1789,18 +1791,18 @@ with vim9 null semantics, the programmer may chose to use null_<type> in
comparisons and/or other situations.
Elsewhere in the documentation it says:
- Quite often a null value is handled the same as an
- empty value, but not always
+ Quite often a null value is handled the same as an empty value, but
+ not always
Here's an example: >
vim9script
var s1: list<string>
var s2: list<string> = null_list
echo s1 # output: "[]"
echo s2 # output: "[]"
-
+
echo s1 + ['a'] # output: "['a']"
echo s2 + ['a'] # output: "['a']"
-
+
echo s1->add('a') # output: "['a']"
echo s2->add('a') # E1130: Can not add to null list
<
@@ -2022,7 +2024,7 @@ Note that this does not work for variables, only for functions.
*import-legacy* *legacy-import*
`:import` can also be used in legacy Vim script. The imported namespace still
becomes script-local, even when the "s:" prefix is not given. For example: >
- import "myfile.vim"
+ import "myfile.vim"
call s:myfile.MyFunc()
And using the "as name" form: >