# from Michael G Schwern
# on Sunday 19 April 2009 13:42:

>X       sort as a number
>X.Y     sort as a number
>X.Y.Z   sort as dotted tuple (allowing X.Y.Z.A.B... if you like)
>
>And that's that.  Have version.pm *always* output at least X.Y.Z.  X.Y
> becomes X.Y.0 or is simply disallowed.  Then there's no confusion and
> no special vX.Y format.

Actually, I think it's:

  X       sort as a dotted tuple
  X.Y     sort as a dotted tuple
  X.Y.Z   sort as a dotted tuple
  X.Y.Z.A sort as a dotted tuple

All of the trouble we've ever had is just that X.Y happens to look like 
some kind of a number and like a dotted 2-tuple.  But instead of perl 
version 5.564.0 or 6.0.x, it was 5.5.640.

So, the missing dots are placed every three digits with omitted zeroes 
provided on the *right*.  This means that everyone is confused and 
v1.5000.7 will not round-trip correctly as a number.  But, as near as I 
can figure it, any decimal number can be compatibly converted to a 
tuple as just:

  perl -e 'printf("%vd\n", join("",map({chr}
    sprintf("%8.6f", eval("$ARGV[0]")) =~ 
      m/(\d+)(?:\.(\d\d\d)(\d\d\d))/
  )));'

John, am I on the right track here?  Are there any cases not handled by 
the above?  (well, ignoring "1.1234567 is 1.123.456.700" and beyond.)

Basically, it looks like there's nothing wrong with versions or how they 
work, only the inconsistent historical accident about where the second 
dot belongs.  So, you can't normalize it *and* stay compatible because 
the de-normalization was a historical accident.

--Eric
-- 
The only thing that could save UNIX at this late date would be a new $30
shareware version that runs on an unexpanded Commodore 64.
--Don Lancaster (1991)
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to