RFE: add has() feature "vim9"

22 views
Skip to first unread message

Tony Mechelynck

unread,
Feb 19, 2020, 11:06:29 AM2/19/20
to Bram Moolenaar, vim_dev
I suggest adding feature 'vim9' testable by has()

This is for consistency, it is not absolutely necessary since ":if
exists(':vim9script') == 2" should give the same result.

I suppose the following is an oversight: In my current 8.2.279 builds,
exists(':vim9script') returns 2 in the Huge build and 0 in the Big
build, which might be expected. However exists(':vim9') returns 1 in
both, which I don't explain. When typing :vim9 at the command-line
followed by <Tab> there is no proposed completion AFAICT, not even in
the Huge build. But :import, :export, :def, :enddef and :disassemble
all return 2 in exists(), even in the Big build, and :disa<Tab> gets
completed to :disassemble and vim9script is one of the proposed
completions for :vi<Tab> (both even in Big).

Best regards,
Tony.

Bram Moolenaar

unread,
Feb 19, 2020, 11:46:09 AM2/19/20
to vim...@googlegroups.com, Tony Mechelynck

Tony wrote:

> I suggest adding feature 'vim9' testable by has()
>
> This is for consistency, it is not absolutely necessary since ":if
> exists(':vim9script') == 2" should give the same result.
>
> I suppose the following is an oversight: In my current 8.2.279 builds,
> exists(':vim9script') returns 2 in the Huge build and 0 in the Big
> build, which might be expected.

I also get 2 in the big build.

> However exists(':vim9') returns 1 in
> both, which I don't explain. When typing :vim9 at the command-line
> followed by <Tab> there is no proposed completion AFAICT, not even in
> the Huge build. But :import, :export, :def, :enddef and :disassemble
> all return 2 in exists(), even in the Big build, and :disa<Tab> gets
> completed to :disassemble and vim9script is one of the proposed
> completions for :vi<Tab> (both even in Big).

--
From "know your smileys":
+<(:-) The Pope

/// 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 ///

Tony Mechelynck

unread,
Feb 19, 2020, 4:37:31 PM2/19/20
to Bram Moolenaar, vim_dev
On Wed, Feb 19, 2020 at 5:46 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Tony wrote:
>
> > I suggest adding feature 'vim9' testable by has()
> >
> > This is for consistency, it is not absolutely necessary since ":if
> > exists(':vim9script') == 2" should give the same result.
> >
> > I suppose the following is an oversight: In my current 8.2.279 builds,
> > exists(':vim9script') returns 2 in the Huge build and 0 in the Big
> > build, which might be expected.
>
> I also get 2 in the big build.

Today, in 8.2.284, so do I. Maybe previously I mistyped?

In the Small buid, exists() gives me 0 for ":vim9" with or without
"script" postfixed to it, 2 for :import, :export, :def, etc., 1 for
:disa, :endd, etc. In the Small and Tiny builds (which are compiled
without +eval) of course there is no exists() function.

Apparently Vim9 scripts themselves are a more restricted feature than
the individual Vim9 commands. I wonder though, how :import could be
used in a Vim executable not supporting full-fledged Vim9 scripts, as
seems to be the case in the Normal build. Or could it refer to :export
statements in a script not headed by a :vim9 line? The help explicitly
mentions the use of :import in legacy scripts (at the very end of the
help for :import, on the easily overlooked vim9.txt lines 445sqq) but
it is not clear (AFAICT) that the import-from script might be a
non-Vim9 script.

Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages