diff runtime/doc/vim9.txt @ 30324:0827d3d6d8c0

Update runtime files Commit: https://github.com/vim/vim/commit/9712ff1288f942736ed76c0dec014909f067eec9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 18 13:04:22 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sun, 18 Sep 2022 14:15:05 +0200
parents fee9eccee266
children 1e91e26ceebf
line wrap: on
line diff
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt*	For Vim version 9.0.  Last change: 2022 Sep 10
+*vim9.txt*	For Vim version 9.0.  Last change: 2022 Sep 15
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -107,7 +107,7 @@ script and `:def` functions; details are
 	`:t`
   	`:xit`
 - Some commands, especially those used for flow control, cannot be shortened.
-  E.g., `:throw` cannot be written as `:th`.
+  E.g., `:throw` cannot be written as `:th`.  *vim9-no-shorten*
 - You cannot use curly-braces names.
 - A range before a command must be prefixed with a colon: >
 	:%s/this/that
@@ -1336,16 +1336,15 @@ This will generate error |E1302|: >
 	       })
 	endfor
 
-You need to create a closure to store the current value of "n", so that it is
-evaluated at the time the closure is created: >
-	def GetClosure(nr: number): func
-	  return (_) => {
-	    echowindow nr
-	  }
-	enddef
-
+You need to use a block and define a variable there, and use that one in the
+closure: >
 	for n in range(4)
-	    timer_start(500 * n, GetClosure(n))
+	{
+	   var nr = n
+	   timer_start(500 * n, (_) => {
+	          echowin nr
+	      })
+	}
 	endfor
 
 Using `echowindow` is useful in a timer, the messages go into a popup and will
@@ -1684,7 +1683,7 @@ deleted.
 
 In Vim9 script the global "g:" namespace can still be used as before.  And the
 "w:", "b:" and "t:" namespaces.  These have in common that variables are not
-declared and they can be deleted.
+declared, have no specific type and they can be deleted.  *E1304*
 
 A side effect of `:vim9script` is that the 'cpoptions' option is set to the
 Vim default value, like with: >
@@ -1825,7 +1824,7 @@ And using the "as name" form: >
 	import "otherfile.vim9script" as that
 	call s:that.OtherFunc()
 
-However, the namespace cannot be resolved on it's own: >
+However, the namespace cannot be resolved on its own: >
 	import "that.vim"
 	echo s:that
 	" ERROR: E1060: Expected dot after name: s:that