At lines 234sqq of vim9.txt:
When {return-type} is omitted the return type will be
decided upon by the first encountered `return`
statement in the function. E.g., for: >
return 'message'
< The return type will be "string".
At lines 290sqq:
A function defined with `:def` must declare the return type. If there is no
type then the function doesn't return anything.
Reminder: In functions defined with :function, ":return" is equivalent
with ":return 0" and fall-through to ":endfunction" implies ":return".
Unless the opposite were clearly said, I would expect the same to
apply (mutatis mutandis s/endfunction/enddef/) to new-style function.
So I don't see how it is possible for a function not to declare a
return type either explicitly (in the :def statement) or implicitly
(in the first :return statement, or by fallback to integer if either
the first return is just :return, or there is no explicit :return and
the function returns only by falling through to its endpoint).
Best regards,
Tony.
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAJkCKXu_g1BaC4Fa2t0PkyYMpsHd0eQCdwrARDHs1%2BF6HOuhTw%40mail.gmail.com.