Overall, however, I would prefer that the implementors of Lua and the
standard library functions continued working on important language
issues, rather than fixing minor inconsistencies in already working
code.2018-07-01 20:47 GMT+02:00 Sam Putman <atmanistan@gmail.com>:
I would strongly prefer that it continue to exhibit this behavior.
I don't yet have the need, but this allows for a re-written require like so
local library = require ("library", ">0.3")
and so on. This would continue to work in contexts which haven't extended
require.
Your reason is not convincing. if you monkey-patch a system function,
and rely on its patched behaviour, you should test that it behaves as
desired. That re-written 'require' presumably errors when the second
argument does not conform the desired syntax. So you pcall it right at
the start of your file and check that it does.
However, I agree with your preference, on the simpler grounds that if
it ain't broke, don't fix it. By Murphy's law, somewhere out there is
a program that has worked for years (probably without a current
maintainer) that will now break.
Anyway, it matters enough to Keni that he wrote a patch, so it's now
up to those who feel likewise to apply that patch and gain some
experience in how they like it.
BTW, I myself use a require patch that I have advertised on this list,
that allows you to say
$ lua -l json=cjson myprog.lua
I.e. you can switch on the command line between different libraries
with the same interface.
It has not yet set the Thames on fire.
-- Dirk