comparison README_VIM9.md @ 21676:1b345fb68ae3

Update runtime files. Commit: https://github.com/vim/vim/commit/e7b1ea0276cc83cd5c612f3189a174a60d57b5ed Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 7 19:54:59 2020 +0200 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Fri, 07 Aug 2020 20:00:05 +0200
parents 94eda51ba9ba
children 0db0640e16e0
comparison
equal deleted inserted replaced
21675:49ed426f3fb5 21676:1b345fb68ae3
3 # What is Vim9? 3 # What is Vim9?
4 4
5 This is an experimental side of [Vim](https://github.com/vim/vim). 5 This is an experimental side of [Vim](https://github.com/vim/vim).
6 It explores ways of making Vim script faster and better. 6 It explores ways of making Vim script faster and better.
7 7
8 WARNING: The Vim9 script features are in the early stages of development, 8 WARNING: The Vim9 script features are still under development, anything can
9 anything can break! 9 break!
10 10
11 # Why Vim9? 11 # Why Vim9?
12 12
13 ## 1. FASTER VIM SCRIPT 13 ## 1. FASTER VIM SCRIPT
14 14
50 That looks very promising! It's just one example, but it shows how much 50 That looks very promising! It's just one example, but it shows how much
51 we can gain, and also that Vim script can be faster than builtin 51 we can gain, and also that Vim script can be faster than builtin
52 interfaces. 52 interfaces.
53 53
54 In practice the script would not do something useless as counting but change 54 In practice the script would not do something useless as counting but change
55 the text. For example, re-indent all the lines: 55 the text. For example, reindent all the lines:
56 56
57 ``` vim 57 ``` vim
58 let totallen = 0 58 let totallen = 0
59 for i in range(1, 100000) 59 for i in range(1, 100000)
60 call setline(i, ' ' .. getline(i)) 60 call setline(i, ' ' .. getline(i))
89 Instead of using script language support in Vim: 89 Instead of using script language support in Vim:
90 * Encourage implementing external tools in any language and communicate 90 * Encourage implementing external tools in any language and communicate
91 with them. The job and channel support already makes this possible. 91 with them. The job and channel support already makes this possible.
92 Really any language can be used, also Java and Go, which are not 92 Really any language can be used, also Java and Go, which are not
93 available built-in. 93 available built-in.
94 * Phase out the built-in language interfaces, make maintenance a bit easier 94 * No priority for the built-in language interfaces. They will have to be kept
95 and executables easier to build. They will be kept for backwards 95 for backwards compatibility, but many users won't need a Vim build with these
96 compatibility, no new features. 96 interfaces.
97 * Improve the Vim script language, it is used to communicate with the external 97 * Improve the Vim script language, it is used to communicate with the external
98 tool and implements the Vim side of the interface. Also, it can be used when 98 tool and implements the Vim side of the interface. Also, it can be used when
99 an external tool is undesired. 99 an external tool is undesired.
100 100
101 All together this creates a clear situation: Vim with the +eval feature 101 All together this creates a clear situation: Vim with the +eval feature
138 138
139 Taking this one step further is also dropping "s:" for script-local variables; 139 Taking this one step further is also dropping "s:" for script-local variables;
140 everything at the script level is script-local by default. Since this is not 140 everything at the script level is script-local by default. Since this is not
141 backwards compatible it requires a new script style: Vim9 script! 141 backwards compatible it requires a new script style: Vim9 script!
142 142
143 To avoid having more variations, the syntax inside a compiled function is the
144 same as in Vim9 script. Thus you have legacy syntax and Vim9 syntax.
145
143 It should be possible to convert code from other languages to Vim 146 It should be possible to convert code from other languages to Vim
144 script. We can add functionality to make this easier. This still needs 147 script. We can add functionality to make this easier. This still needs
145 to be discussed, but we can consider adding type checking and a simple 148 to be discussed, but we can consider adding type checking and a simple
146 form of classes. If you look at JavaScript for example, it has gone 149 form of classes. If you look at JavaScript for example, it has gone
147 through these stages over time, adding real class support and now 150 through these stages over time, adding real class support and now