Sunday, June 20, 2021

Re: Translating complete functions to Vim9

> Is there a way to turn a completion function (:h complete-functions)
> into Vim9 script?
>
> The issue is that such functions are called twice, and they are expected
> to return values of different types in each call.

You can use the return type "any".

I know in typescript it is possible to combine two types, e.g. you can
use "string | number". But not many other languages use this. I am not
convinced adding the combined type to Vim 9 script is a good choice.

For newly added builtin functions we will avoid mixing types, both for
the arguments and for the returned value. But several of the existing
functions do allow for different types, since they were designed for
runtime type checking.

--
hundred-and-one symptoms of being an internet addict:
28. You have comandeered your teenager's phone line for the net and even his
friends know not to call on his line anymore.

/// Bram Moolenaar -- Bram@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 ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202106201332.15KDWgCU336895%40masaka.moolenaar.net.

No comments: