Locations of changes are indicated by reference to *tag* in the updated file.
The sentence, “When using :function”, is not quite the whole story - e.g., behaviour may differ too. It would be too early (and dilute the point about scriptversion) for an example, though a variant of the example now provided at :vim9[cmd] would demonstrate that it is not just a matter of syntax:
vim9script
function Elegacy()
echo 'é'[0]
endfunction
def Enine(): void
echo 'é'[0]
enddef
Elegacy() # Echos byte <c3>
Enine() # Echos é
The scriptversion point is a bit inconsistent in using the word, “highest”, noting that eval.txt says explicitly:
When using a legacy function, defined with `:function`, in |Vim9| script then scriptversion 4 is used.”
(It is probably of little consequence with, I'm guessing, most of those reading vim9.txt not wanting to use legacy Vim script anyway, and even fewer wanting to use a scriptversion other than the latest.)
*:vim9* *:vim9cmd*
The tag *E1164* is relocated later (with an example).
The paragraph is extended to stress that behaviour is relevant too.
An example and explanation demonstrates the points, i.e., just a few lines show important differences in syntax, semantics, and behaviour.
It could also include this explanation (in the first note):
In the first popup notification, the result is "[769, 101]", being the
second byte of the penultimate character, "é" - itself made up of "e" and a
combining acute accent (U+0301, decimal 769) - and the last character, "e"
(U+0065, decimal 101). The second popup notification returns "[101]"
because the sixth character in the string is the "e" (i.e., at the end
of the word, "entrée".
That has not been provided. I think that may be too much / dilute the other the points.
*E1164*
:vim9[cmd] without any following command.*:leg* *:legacy*
*E1189* and *E1234* are relocated later because they are caused by very specific things (which deserve distinct, explicit explanations).:vim9cmd. The example, which is the Vim9 script equivalent to the example preceding it, is similarly brief.:legacy can utilise Vim9 script-local variables by prefixing "s:", just like in a legacy Vim script. So, the paragraph replaces the Note, and now focuses on what you can do.*E1189*
*E1234*
*E1164*, for a standalone vim9cmd, this is explained separately, though should hopefully be sufficiently obvious to not require an example. vim9cmd legacy standalone is also an E1189 error, also showing that they can be “stacked”, though it is better not to go there! – vim9cmd legacy vim9cmd legacy vim9cmd echo "hi" anyone?]vim9.txt - aside from Section 2 - now has lots of complete, sourceable examples. (Section 2 is all that is left to update once this PR has been merged.)https://github.com/vim/vim/pull/18855
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()