Vim9: Compile time argument type checks for built-in functions

24 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Jul 25, 2021, 11:29:20 AM7/25/21
to vim_dev
Hi all,

Patch 8.2.3221 added the last of the Vim9 compile time argument
type check for built-in functions. Now the 525 built-in functions have
argument type checks. If you run into any problems with these
checks or if the checks can be improved, let us know.

Thanks,
Yegappan

Bram Moolenaar

unread,
Jul 25, 2021, 12:44:13 PM7/25/21
to vim...@googlegroups.com, Yegappan Lakshmanan
Awesome work! Not only do we now have compile time type checking, also
a lot more tests were added.

We are getting closer and closer to launching Vim9 script. But I do
keep finding bugs, we still need to test more. Ideally all the tests
run on legacy script are also run on compiled functions and Vim9 script.

--
hundred-and-one symptoms of being an internet addict:
236. You start saving URL's in your digital watch.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

bfrg

unread,
Jul 25, 2021, 1:17:45 PM7/25/21
to vim...@googlegroups.com
On 2021-07-25, Bram Moolenaar wrote:
>
> Yegappan wrote:
>
> > Patch 8.2.3221 added the last of the Vim9 compile time argument
> > type check for built-in functions. Now the 525 built-in functions have
> > argument type checks. If you run into any problems with these
> > checks or if the checks can be improved, let us know.
>
> Awesome work! Not only do we now have compile time type checking, also
> a lot more tests were added.
>
> We are getting closer and closer to launching Vim9 script. But I do
> keep finding bugs, we still need to test more. Ideally all the tests
> run on legacy script are also run on compiled functions and Vim9 script.

1. Once Vim9 is officially released will we still have to specify "vim9script"
at the top of the script file?

2. Will the parsed Vim9 script files eventually be written to a .vimc file,
similar to .pyc or .luac? It would certainly increase the startup time since
more often than not script files are not modified when launching Vim.

Bram Moolenaar

unread,
Jul 25, 2021, 2:27:48 PM7/25/21
to vim...@googlegroups.com, bfrg

> 1. Once Vim9 is officially released will we still have to specify "vim9script"
> at the top of the script file?

Yes, old scripts have to keep working as before. I don't see another way
then to add something at the top of a Vim 9 script. Finding something
specific for legacy or Vim 9 script won't be reliable.

> 2. Will the parsed Vim9 script files eventually be written to a .vimc
> file, similar to .pyc or .luac? It would certainly increase the
> startup time since more often than not script files are not
> modified when launching Vim.

Script files are not compiled. For functions it could be possible.
However, I suspect that checking that nothing has changed won't be much
faster. We can add this later without changing the syntax or semantics,
if it turns out to be worth the effort.

--
hundred-and-one symptoms of being an internet addict:
237. You tattoo your email address on your forehead.
Reply all
Reply to author
Forward
0 new messages