lua-users home
lua-l archive

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


Am 17.04.2014 13:30 schröbte steve donovan:
On Thu, Apr 17, 2014 at 12:57 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
So, IMHO, what makes this case different is that the monkey-patches are
intended as conveniences for new code only, not to change the behavior of
old code

Absolutely!

   [*] almost (e.g. the return values of `os.exit` are incompatible)

That's when a disciplined patcher has to stop.  For Penlight, I got
around this by providing utils.execute and utils.load which have 5.2
semantics.

Ah, I meant `os.execute` not `os.exit` (which usually doesn't return at all) ...

Plus, utils.getfenv is always defined, since kind people
pointed out that checking for existence of getfenv is a common enough
way to detecting 5.2.  The only global alterations left are that
table.pack and table.searchpath are added in 5.1.


So maybe we should try to define what "acceptable" monkey-patches are (in case legacy code might be involved) ...

*   adding new functions/fields to existing modules?
*   adding additional (optional) parameters to existing functions?
*   adding additional return values?
*   handling arguments that previously would've raised an error?
* increasing the value range of parameters and/or return values of an existing function?
*   ... ?

Philipp