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:58 AM, Vadim Peretokin <vperetokin@gmail.com> wrote:
> Neither of these are particularly human friendly.
> Why does it have to be triple digits and not trimmable?
>> On 8 November 2011 16:27, David Manura <dm.lua@math2.org> wrote:
>> > I propose the following scheme for the _VERSION [1] variable in modules:
>> > Examples of valid versions include '001', '001.234', and
>> > '012.001.001.001'.

It is a trade-off.  The main intention of the zero padding is to allow
versions to be compared by simple string comparison, i.e. without any
external version library like verlib [1].

  local B = require 'baz'
  local V = require 'verlib'
  if V(B._VERSION) >= V'1.2.5' then
       -- as opposed to just `B._VERSION >= '001.002.005'`
   . . .
  else
    . . .
  end

Implementing verlib in Lua would also be a valid approach though.
Should we bother?  With git, we just accept unfriendly version numbers
(e.g. 8d1985807b).

[1] http://www.python.org/dev/peps/pep-0386/