# from Michael G Schwern # on Monday 20 April 2009 13:05: >> Sure, you can't just treat a float as a tuple without fixing the >> width of the second column. I imagine this is where everybody gets >> confused and I think all we need to do is explain that. >> >> X convert to vX >> X.Y convert to vX.Y00 >> X.YY convert to vX.YY0 >> X.YYY convert to vX.YYY >> X.YYYZ convert to vX.YYY.Z00 >> >> vX sort as a dotted tuple >> vX.Y sort as a dotted tuple >> vX.Y.Z sort as a dotted tuple >> vX.Y.Z.A sort as a dotted tuple > >I was almost convinced, then I remembered what caused this whole > problem. Class::Delegation went from 1.06 to 1.7.1. That's 1.60.0 to > 1.7.1 in your system. Text::Autoformat went from 1.13 to 1.14.0 > which is 1.130.0 to 1.14.0. These are all incorrect, but not > obviously so.
But that is (and always was) just "doing it wrong". $ perl -Mversion -E 'say version->new("1.06")->normal' v1.60.0 $ perl -Mversion -E 'say version->new("1.13")->normal' v1.130.0 > CPAN authors > already have to write $VERSION = "1.20", so we know how many places > are in their Y portion. Use it. 1.06 becomes 1.6.0, as expected. > 1.20 becomes 1.20.0, as expected. They do? Making a distinction between "1.20" and "1.200" isn't going to solve the confusion. The current system treats them both as v1.200.0. It's a simple insertion of dots at "every three places". (Where we add zeroes until we get to a number of places which is a multiple of 3.) >Converting numeric X.Y to tuple X.Y.Z is going to have to make an > assumption, and its going to be wrong in some cases. It's a *convention*, not assumption. To preserve sort order, you have to left-align the decimal portion. Essentially, consider the decimal portion as being zero-padded to infinity. Now, because infinity causes problems, we chose to insert dots at every three places. Aside: it _should have been_ "insert dots at every one place". 1.06 -> 1.0.6 1.0859 -> 1.0.8.5.9 But, we're too late for that. The number is 3. Unfortunately, I don't think we can go back on that because we have to preserve the sort order for any distro which changed from float to tuple. --Eric -- "Politics is not a bad profession. If you succeed there are many rewards, if you disgrace yourself you can always write a book." --Ronald Reagan --------------------------------------------------- http://scratchcomputing.com ---------------------------------------------------