Update runtime files
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index c29ff5e..cc3f512 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 8.2. Last change: 2020 Apr 10
+*options.txt* For Vim version 8.2. Last change: 2020 May 03
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index fe41907..7bc3945 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 8.2. Last change: 2020 Apr 30
+*todo.txt* For Vim version 8.2. Last change: 2020 May 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -39,22 +39,22 @@
-------------------- Known bugs and current work -----------------------
Vim9 script:
-Big changes, need design:
+Big changes, may need design:
- Make closures work:
- Grab the part of the stack that has the arguments and local vars.
- Pass a pointer and offset to the closure where this stack fragment is (frame
- pointer).
- When a closure disappears at end of the function - nothing to do.
- When a closure remains at end of the function: copy frame, attach to closure.
+ - call closure from not compiled context
+ - Create closure in a loop. Need to make a list of them.
+- Having constant expr evaluation separate does not scale.
+ First parse the expression, then simplify, then generate code.
- At the vim9 script level: Allow using a function that is defined later.
Requires compiling functions only when the whole script has been sourced.
Like Javascript "hoisting", but only at the script level:
+ 0. If script was sourced before, clear all script-local functions and
+ variables. (variables still to be implemented)
1. Discovery phase: Read the file to find all functions, variable
declarations and imports If a variable has a constant expression we get
the type, otherwise it will be "any". Follow imports recursively.
2. Compilation phase: compile :def function bodies, using declared types
3. Execution phase: Execute imports when encountered. (skip over functions)
-- When sourcing a script again, also delete script-local variables.
Making everything work:
- Test that a script-local function in Vim9 script cannot be deleted.
- Test that a function defined inside a :def function is local to that
@@ -80,10 +80,6 @@
- eval_expr() in ex_cexpr()
- eval_expr() call in dbg_parsearg() and debuggy_find()
New syntax and functionality:
-- define function and create funcref in one step:
- let ref = def(arg: type): rettype
- body
- enddef
Improve error checking:
- "echo Func()" is an error if Func() does not return anything.
Also:
@@ -118,6 +114,10 @@
- compile options that are an expression, e.g. "expr:" in 'spellsuggest',
'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'.
+- Make inline function work, to be used as a funcref:
+ let ref = def(arg: type): rettype
+ body
+ enddef
- compile get_lambda_tv() in popup_add_timeout()
- compile "skip" argument of searchpair()
- compile "expr" and "call" expression of a channel in channel_exe_cmd()?
@@ -254,9 +254,14 @@
Patch to add Turkish manual. (Emir Sarı, #5641)
+Patch to add getmarklist() (Yegappan, #6032)
+
Patch to support different color for undercurl in cterm.
(Timur Celik, #6011)
+When SIGTSTP is ignored, don't let CTRL-Z suspend Vim? (Kurtis Rader, #5990)
+Fixed by patch #6026. Makes tests fail...
+
Patch to support cindent option to handle pragmas differently.
(Max Rumpf, #5468)
@@ -356,8 +361,6 @@
Patch to include reduce() function. (#5481)
-When SIGTSTP is ignored, don't let CTRL-Z suspend Vim? (Kurtis Rader, #5990)
-
Statusline highlighting error, off by one. (#5599)
Enable 'termbidi' if $VTE_VERSION >= 5703 ?
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 525393d..cb880c1 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 8.2. Last change: 2020 Apr 30
+*vim9.txt* For Vim version 8.2. Last change: 2020 May 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -125,10 +125,56 @@
found in the script, either defined there or imported. Global functions and
variables could be defined anywhere (good luck finding where!).
-Global functions can be defined and deleted at nearly any time. In Vim9
-script script-local functions are defined once when the script is sourced and
-cannot be deleted. Except that when the same script is sourced again all
-existing script-local functions and variables are deleted.
+Global functions can be still be defined and deleted at nearly any time. In
+Vim9 script script-local functions are defined once when the script is sourced
+and cannot be deleted.
+
+
+Four phases when loading a Vim9 script ~
+
+In legacy script the functions are created when encountered, but parsed only
+when used. This allows for defining functions in any order and having them
+call each other: >
+ func One()
+ call Two()
+ endfunc
+ func Two()
+ if cond
+ call One() " recursive call
+ endif
+ endfunc
+ call One()
+
+In Vim9 script the functions are compiled. If using the same functions as the
+above example it is not possible to compile function One without knowing that
+function Two exists. Or this would require a runtime check, which is slow and
+does not allow for compile time type checking.
+
+When sourcing a Vim9 script this happens in four phases:
+1. Cleanup: If the script was sourced before all script-local variables,
+ imports and functions are deleted.
+2. Discovery: The script is read and encountered functions, imports and
+ variables are recognized. The type is parsed. Variable initializers that
+ are a constant are evaluated, this can give the type of the variable.
+3. Compilation: Functions are compiled. The script-local functions, imports
+ and variables from the discovery phase are recognized and types are
+ checked.
+4. Execution: the commands in the script are executed. Functions are skipped
+ over. Variable initializers are evaluated, unless they are a constant.
+
+The result is that items defined at the script level can be used anywhere in
+the script. This allows for putting the main function at the top: >
+ def Main()
+ SubOne()
+ SubTwo()
+ enddef
+ def SubOne()
+ ...
+ def SubTwo()
+ ...
+
+Note that script-local variables should either have a type defined or have a
+constant initializer. Otherwise an error is given for the type being unknown.
Variable declarations with :let and :const ~