Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the "2.0.1.0 > 2.0.1" example, or clarify that this is bad #36

Open
andreasabel opened this issue Oct 24, 2021 · 4 comments
Open

Comments

@andreasabel
Copy link
Member

It is true that 2.0.1.0 > 2.0.1 in the lexicographic ordering, because mathematically, a missing number at the end counts as minus infinity. However, in versioning practice, a missing number at the end defaults to 0.

If after 2.0.1 you release 2.0.1.0, it is either by accident, ignorance or spite, in order to confuse others; imo.

There is already a more fundamental discussion at #4, I raised this issue to at least remove or better comment the 2.0.1.0 > 2.0.1 example which could give the idea that such versioning is good practice.

@phadej
Copy link
Collaborator

phadej commented Oct 24, 2021

What concretely you are proposing? Adding an entry to a FAQ, https://github.com/haskell/pvp/blob/master/pvp-faq.md? That would be great.

@andreasabel
Copy link
Member Author

andreasabel commented Feb 6, 2022

I came across an upper bound shelly < 0.10.0 in the wild: https://hackage.haskell.org/package/c2hs-0.28.8/revisions/
So had I released shelly as 0.10 (rather than 0.10.0 what I did) this major upgrade would have slipped through the fence.
It seems that by analogy to decimal representation, folks naturally expect 0.10.0 == 0.10.
If such equations would hold in general, then versions would be "omega-adic" numbers ($\sum_i a_i*\omega^{-i}$ where $i$ ranges over all natural numbers and each $a_i$ is a natural number).
(EDIT: Less scary concept than "omega-adic" numbers: Polynomials $\sum_i a_i x^{i}$ with natural number coefficients $a_i$ and $0 \leq x &lt; 1$.)

Maybe cabal check should warn if there is a exclusive upper bound with trailing zeros, like < 0.10.0?

@phadej
Copy link
Collaborator

phadej commented Feb 6, 2022

Maybe cabal check should warn if there is a exclusive upper bound with trailing zeros, like < 0.10.0?

As long as that doesn't prevents making revisions, as currently revisions cannot introduce more warnings (IIRC). Even the situation where adding < 0.10.0 like bound is not probable, it can happen (and may be caused by an accident, ignorance or spite!)

EDIT: I.e. there should be a way to tell that if there is < 0.10.0 -like bound, I really need that trailing zero, i.e. to make cabal check not complain when it's intentional.

@andreasabel
Copy link
Member Author

there should be a way to tell that if there is < 0.10.0 -like bound, I really need that trailing zero, i.e. to make cabal check not complain when it's intentional.

If cabal check was configurable by flags to turn off individual warning classes (like GHC is), we could make a separate warning class that could be switched off in the rare cases when such a bound is intended. (Haskell CI could be extended to be able to pass such flags to cabal check.)
(I'd rather not extend the .cabal file format with pragmas to turn off cabal check warnings.)

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

No branches or pull requests

2 participants