[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg 0.10
- From: Nick Gammon <nick@...>
- Date: Wed, 10 Nov 2010 14:29:47 +1100
On 10/11/2010, at 1:36 PM, Miles Bader wrote:
> Nonetheless, it's a very standard format for version numbers.
Yes I understand.
However the documentation for lpeg.version says:
> lpeg.version ()
>
> Returns a string with the running version of LPeg.
This is inconclusive about how to compare versions.
My example:
print ("0.10" > "0.9") --> false
Norbert Kiesel's comparison:
test('0.9', '0.10') --> 0.9 0.10 -1
We get different results, and just assuming that you should compare in a certain way is likely to cause grief, as indeed it did recently with the LuaJSON library.
If I may suggest, the documentation could be amended to say something like:
"Versions should be compared, not as pure strings (nor as a decimal number), but using standard "version" comparisons where each group of digits is to be considered individually. More information: http://semver.org/"
By way of comparison, SQLite3 provides both a string version (printable form) and a numeric version along the lines of 3007004 for version 3.7.4. The numeric version can be directly compared without any mucking around with special comparison functions.
- Nick