Skip to content

propsal: Make "v:" prefix mandatory in scriptversion 2#4274

Closed
k-takata wants to merge 2 commits intovim:masterfrom
k-takata:v-prefix-in-scriptversion2
Closed

propsal: Make "v:" prefix mandatory in scriptversion 2#4274
k-takata wants to merge 2 commits intovim:masterfrom
k-takata:v-prefix-in-scriptversion2

Conversation

@k-takata
Copy link
Member

With this patch, "version" cannot be used as "v:version" in scriptversion 2 anymore.
It can be used as a normal variable. (Same for "v:count" and other "v:" variables.)

What do you think?

"version" cannot be used as "v:version" in scriptversion 2 anymore.
It can be used as a normal variable.
@codecov-io
Copy link

codecov-io commented Apr 17, 2019

Codecov Report

Merging #4274 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4274      +/-   ##
==========================================
+ Coverage   79.76%    79.8%   +0.04%     
==========================================
  Files         106      106              
  Lines      141579   141576       -3     
==========================================
+ Hits       112926   112982      +56     
+ Misses      28653    28594      -59
Impacted Files Coverage Δ
src/ex_cmds2.c 87.56% <100%> (+2.68%) ⬆️
src/eval.c 85.9% <100%> (+0.13%) ⬆️
src/gui_gtk_x11.c 48.32% <0%> (-0.59%) ⬇️
src/if_xcmdsrv.c 84.02% <0%> (-0.18%) ⬇️
src/term.c 69.15% <0%> (-0.16%) ⬇️
src/os_unix.c 59.3% <0%> (-0.09%) ⬇️
src/window.c 86.36% <0%> (-0.04%) ⬇️
src/evalfunc.c 88.72% <0%> (-0.01%) ⬇️
src/version.c 88.49% <0%> (ø) ⬆️
src/terminal.c 80.46% <0%> (ø) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a4dce7...1f8f6c0. Read the comment docs.

@brammool
Copy link
Contributor

brammool commented Apr 18, 2019 via email

@k-takata
Copy link
Member Author

Do you consider that the specification of scriptversion 2 has been already fixed?
I thought that we haven't released Vim 8.2 yet, so the specification could be still changed.
We can still use has('patch-8.1.xxxx') to check if the v: prefix is mandatory or not.

@brammool
Copy link
Contributor

brammool commented Apr 19, 2019 via email

@k-takata
Copy link
Member Author

Well, what is the drawback of using scriptversion 3?

Maybe, no.

@brammool brammool closed this in d2e716e Apr 20, 2019
@k-takata k-takata deleted the v-prefix-in-scriptversion2 branch April 20, 2019 12:54
@mg979
Copy link
Contributor

mg979 commented Apr 22, 2019

Excuse the intrusion, but I think there is a drawback in letting the scriptversion number progress too fast. It would become little different from practices like has('patch_x'): there are so many that one should research at which patch level feature x has been implemented and it's a nightmare from my point of view. If there are too many scriptversion numbers, one would be tempted to just use the latest one to be sure, instead of checking which one is the minimum required, thus making the latest vim version a requirement. But I think few people would do that, because most people that write plugins don't want to enforce the use of last vim version, nor write the same code 3-4 times to take into account different scriptversion's.

I hope you can make some sense of what I'm saying. I think it would be more reasonable to aggregate more changes in a single scriptversion revision. It would then be much easier to say vim 8.2 or vim 8.3 is required. Otherwise this could just add up to the has('patch_x') nightmare.

@ychin
Copy link
Contributor

ychin commented Apr 22, 2019

I think there's also the issue that every single script version currently has to be supported by the Vim codebase, as we will start seeing Vim plugins written with different script version expectations. The more distinct script versions the codebase accrue, the more possible code paths Vim will have to maintain till eternity with different avenues for potential bugs.

@tonymec
Copy link

tonymec commented Apr 22, 2019

I suppose that the idea is to deprecate old-style syntax, and then, maybe 20 years from now ;-) stop supporting it.

To alleviate a little the task of plugin authors concerning various "script versions", I suggest that has('scriptversion') with no suffix be marked as reserved (i.e. not to be used) until or unless pre-scriptversion-1 syntax ceases to be supported. That way, if !has('scriptversion') can be tested to make sure that old-style syntax can still be used.

A positive feature name can of course not be defined for that purpose, since Vim 7 and earlier would never recognise it.

Best regards,
Tony.

@chdiza
Copy link

chdiza commented Apr 22, 2019

There was no reason to jump to 3, and the OP seemed to admit that.

@brammool
Copy link
Contributor

brammool commented Apr 23, 2019 via email

@brammool
Copy link
Contributor

brammool commented Apr 23, 2019 via email

seandewar added a commit to seandewar/neovim that referenced this pull request May 21, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request May 21, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request May 22, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Jun 2, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Jun 5, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Jun 25, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Jun 26, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Aug 26, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Aug 26, 2021
Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

Include scriptversion-3 section in eval.txt from
vim/vim@911ead1.
seandewar added a commit to seandewar/neovim that referenced this pull request Sep 10, 2021
Problem:    Cannot enforce a Vim script style.
Solution:   Add the :scriptversion command. (closes vim/vim#3857)
vim/vim@558ca4a

:scriptversion is N/A, but ":let ..=" is relevant.

N/A patches for version.c

vim-patch:8.1.1188: not all Vim variables require the v: prefix

Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

vim-patch:8.1.1190: has('vimscript-3') does not work

Problem:    has('vimscript-3') does not work.
Solution:   Add "vimscript-3" to the list of features.
vim/vim@93a4879

vim-patch:8.1.2038: has('vimscript-4') is always 0

Problem:    has('vimscript-4') is always 0.
Solution:   Add "vimscript-4" to the feature table. (Naruhiko Nishino,
            closes vim/vim#4941)
vim/vim@af91438

vim-patch:8.1.2043: not sufficient testing for quoted numbers

Problem:    Not sufficient testing for quoted numbers.
Solution:   Add a few more test cases.
vim/vim@ea8dcf8
seandewar added a commit to seandewar/neovim that referenced this pull request Sep 11, 2021
Problem:    Cannot enforce a Vim script style.
Solution:   Add the :scriptversion command. (closes vim/vim#3857)
vim/vim@558ca4a

:scriptversion is N/A, but ":let ..=" is relevant.

N/A patches for version.c

vim-patch:8.1.1188: not all Vim variables require the v: prefix

Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

vim-patch:8.1.1190: has('vimscript-3') does not work

Problem:    has('vimscript-3') does not work.
Solution:   Add "vimscript-3" to the list of features.
vim/vim@93a4879

vim-patch:8.1.2038: has('vimscript-4') is always 0

Problem:    has('vimscript-4') is always 0.
Solution:   Add "vimscript-4" to the feature table. (Naruhiko Nishino,
            closes vim/vim#4941)
vim/vim@af91438
lewis6991 pushed a commit to lewis6991/neovim that referenced this pull request Dec 12, 2021
Problem:    Cannot enforce a Vim script style.
Solution:   Add the :scriptversion command. (closes vim/vim#3857)
vim/vim@558ca4a

:scriptversion is N/A, but ":let ..=" is relevant.

N/A patches for version.c

vim-patch:8.1.1188: not all Vim variables require the v: prefix

Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
vim/vim@d2e716e

vim-patch:8.1.1190: has('vimscript-3') does not work

Problem:    has('vimscript-3') does not work.
Solution:   Add "vimscript-3" to the list of features.
vim/vim@93a4879

vim-patch:8.1.2038: has('vimscript-4') is always 0

Problem:    has('vimscript-4') is always 0.
Solution:   Add "vimscript-4" to the feature table. (Naruhiko Nishino,
            closes vim/vim#4941)
vim/vim@af91438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants