noahfrederick / vim-hemisu

A Vim color scheme with dark and light variants
https://noahfrederick.com/vim-color-scheme-hemisu/
279 stars 30 forks source link

Version tags have a leading character #11

Closed Ichimonji10 closed 5 years ago

Ichimonji10 commented 5 years ago

Version numbers are prefixed by a leading character, "v". This practice is pointless, breaks with existing conventions, and makes implementing version comparison logic harder.

It's pointless because an entity (such as a person or a program) that's examining a version number already knows that the string they're looking at is a version number. The leading "v" doesn't help them figure out that the string they're looking at is a version number - they already knew that.

It breaks with conventions like PEP 440 and semver. PEP 440 specifies that a leading "v" character should be discarded. And semver makes no use of a leading "v" character.

To understand why it makes implementing version comparison logic harder, consider how each additional allowable string (like "alpha," "beta," and "rc") push one further from the simple case of splitting a version string on dots, casting each segment to an integer, and comparing segments from left to right.

I understand, of course, that it's a common convention, and even vim uses a leading "v", so you use your best judgment. :smile:

tamasgal commented 5 years ago

I guess you are referring to the Git tag? I don't see any version definition otherwise...

Note that a v prefix for a Git tag which is representing a version is very common and makes it very easy to distinguish between other tags, branches or commits. I usually infer the version number from the Git tag and drop the leading v, which is also a very common thing (as you already pointed out in PEP 440 for Python and of course the semver definition).

Ichimonji10 commented 5 years ago

I guess you are referring to the Git tag?

Yes, that's the one.

Note that a v prefix for a Git tag which is representing a version is very common

No argument about the prevalence about the practice.

and makes it very easy to distinguish between other tags, branches or commits. I usually infer the version number from the Git tag and drop the leading v, which is also a very common thing (as you already pointed out in PEP 440 for Python and of course the semver definition).

Adding a preceding "v" undoubtedly helps a human distinguish between tags and other things in some circumstances. But on the whole, I doubt that this is actually all that useful. As an example, git tag --list only shows tags, and not branches or commits. git log clearly labels tags by preceding them with the phrase tag:. And the GitHub releases page also only shows tags.

One the whole, there's little real harm in leaving a preceding "v." The practice is common enough that tools can work around it. But that doesn't make it an inherently good practice, for the reasons I pointed out in the original comment, and also because having to work around the practice adds just a little more friction to packaging this project.

noahfrederick commented 5 years ago

In this case, I believe the "v" prefix came from git-bump, which enforces this convention. In addition, both Vim and Neovim follow the same convention. I'm sticking with the prefix for those reasons.