Monday, May 27, 2019

[siqvwkor] Tree-like version numbers

Version numbers are often expressed as dotted strings of numbers.  We consider extending the notation to allow a parenthesized version number where a single number would have gone.  Versions get compared component by component, as always, with earlier components taking priority.  Here are some versions in decreasing order:

  • 57.2
  • 57.(1.5).1
  • 57.(1.5)
  • 57.1.9
  • 57.1.5.1
  • 57.1.5
  • 57.1

Not sure what this would be useful for; it is potentially confusing.

Of course, parenthesized version elements can have further parentheses inside them: ((1.2).3).4.5.(6.(7.8).9)  It is isomorphic to a tree.

A parenthesized single number, (number), is the same as the number by itself: 57.1.9 = 57.(1).9

You may need a way of comparing a version number with a longer one ending in zeroes.  Two ways of doing this are

  • x = x.0 = x.0.0 = ...
  • x < x.0 < x.0.0 < ...

(The latter is rare, though inspired by lexicographic ordering in which the empty string comes before any letter.)

() might be the same as 0, or less than zero, depending on the ordering question mentioned above: 6.0.1 versus 6.().1

No comments :