lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Nov 8, 2011 at 1:55 AM, Daurnimator <> wrote:
> I think a system where everything is a number would be much better:
>  - They can be used directly in comparisons without any forethought
>  - They can be almost arbitrarily large (as long as it fits in a double)
> They don't need any regulations; as they are a native lua type - to
> check if a module conforms you can just use type(mod._VERSION) ==
> "number"

True, but on the other hand:

  - The type used for Lua numbers is undefined (could even be integer
or single precision non-IEEE float).
  - There is not a unique way to format a number as a string.
_VERSION=0.000010; print(_VERSION) --> 1e-5.
  - You still need padding.  Using 1.10 > 1.09 rather than 1.10 > 1.9
is not that bad, but representing things like with 1.000000007
suffers from readability due to counting zeros.

You could alternately use positive integers (1,2,3,...), but this
prohibits later inserting a version between older version numbers
(e.g. for patches).