[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require() parse error in 5.3.4/5.4.0-work2?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 2 Jul 2018 10:30:46 +0200
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 <firstname.lastname@example.org>:
> 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
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.