I wrote:
> John Beckett wrote:
>
> > On Thursday, February 10, 2022 at 12:27:18 AM UTC+11 Bram Moolenaar wrote:
> >
> > > This comes from converting a legacy script to Vim9. So the question is
> > > whether it is good to force removing the "s:" prefix or is it more
> > > convenient to let it there?
> >
> > If s: is never needed in vim9script, it should be an error to include it.
> > As someone learning to use the new system, I want firm guidance—should I
> > include s: or not? If I see it in someone's script, I'm going to wonder if
> > it should be in mine (perhaps there is a performance advantage or something
> > else I don't know about). It wastes everyone's time if arcane syntax is
> > sometimes used.
> >
> > There will never be another opportunity to decide how vim9script should
> > work.
>
> It's definitely cleaner to just disallow using "s:" in any Vim9 script.
> It fits in with not allowing defining script level items (functions and
> variables) in a function.
>
> It is required of the user to understand that functions without "s:" are
> script-local, but was already the case anyway, since it could be left
> out.
>
> Let me look into it, see what would fail.
One situation where we would still need to use "s:" is when a :def
function is used in a legacy script. There it is possible to create a
new script variable, and also :unlet it.
This is the opposite of using a legacy function in a Vim9 script, where
it is required to use the "s:" prefix to access script-local variables.
It is even possible to define new script-local variables. But :unlet
can't be used, which is inconsistent. We probably need to disallow
creating new script variables, they should be declared at the script
level.
--
How To Keep A Healthy Level Of Insanity:
17. When the money comes out the ATM, scream "I won!, I won! 3rd
time this week!!!!!"
/// Bram Moolenaar -- [email protected] -- 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_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/20220210223105.97D1C1C12CB%40moolenaar.net.