vim9: script local function name starting with a lower-case letter

7 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Dec 21, 2020, 11:19:25 AM12/21/20
to vim_dev
Hi,

In legacy Vim scripts, a script local function prefixed with "s:" can
start with a lower-case letter. A Vim9 function explicitly prefixed
using "s:"can also start with a lower-case letter.

But a vim9 function name that doesn't have an explicit "s:" prefix
cannot start with a lower-case letter. A Vim9 function has a script-local
scope by default.  So should it be allowed to start with a lower-case
letter?

Regards,
Yegappan

Bram Moolenaar

unread,
Dec 21, 2020, 1:59:46 PM12/21/20
to vim...@googlegroups.com, Yegappan Lakshmanan
I suppose we could allow it. The idea is that we don't want a user
defined function shadow a builtin function unexpectedly, also when the
builtin function is added a year later. That is a problem for global
functions, not su much for script-local functions. It still shadows the
builtin function, but it's local to a script, so you know what function
you want to call.

--
Bad fashion can discourage normal people from interacting with the engineer
and talking about the cute things their children do.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages