1

As Semantic Versioning (and common sense) declares - the major version is incremented in case if non backward compatible change is introduced.

Now let's assume we have a project called Project that has a current version 1.0.42 and a library Lib it depends on that is of a 2.1.3 version at the moment.

Does that mean that following semver ideology we should constraint the dependency of the Project to be Depends: Lib (< 3)?

From my experience - no one does that, but I find it semantically correct and very self-descriptive.

What do you think of this?

  • 1
    Technically, Lib (>= 2.x, < 3) where x is the minor version that introduced the latest feature you rely on (perhaps a patch version too if you depend on a recent bug fix) would be safer, as it rules out 2.(x-1) which your code wouldn't work with. – user7043 May 30 '13 at 22:36
  • @delnan: would you like to post it as an answer? – zerkms May 30 '13 at 23:25
  • My guess is that semantic versioning isn't followed widely and strictly enough for people to generally depend on it. – Bart van Ingen Schenau May 31 '13 at 7:32
  • @Bart van Ingen Schenau: you still need to follow some convention – zerkms May 31 '13 at 7:33
  • @zerkms: As author of Project, does the fact that Lib has version2.1.3 guarantee you that the authors of Lib strictly follow semantic versioning? Perhaps they don't and remove a function in version 2.2. – Bart van Ingen Schenau May 31 '13 at 8:04
3

The RubyGems package management system has the pessimistic version constraint for precisely this reason:

~> 1.2.3

means "chop off the last component of the version number and treat it is a wildcard, but don't use a version less than specified", IOW

~> 1.2.3

means

1.2.* && >= 1.2.3

and

~> 1.2.3.4

means

1.2.3.* && >= 1.2.3.4

In other words, it means: any version at least as new as the one that was specified, but only within the same "category". So, if you specify a bugfix release, you will get newer bugfix releases but no new minor version. If you specify a minor verso, you will get newer minor versions but no new major version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.