lua-users home
lua-l archive

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


Am 16.04.2014 23:46 schröbte Hisham:

On 16 April 2014 14:55, Philipp Janda <siffiejoe@gmx.net> wrote:
There are always better solutions; the mechanisms that allow monkey
patching are there for low-level metaprogramming, not for regular
module/application development.

I agree in general, yet we both have contributed to a publicly available
module[1] that does _nothing but_ monkey-patching ...

Well, yeah, but one could argue that this is almost the kind of
low-level plumbing I was referring to. Steve made us a good defense by
arguing that it has a disciplined interface.

A disciplined interface doesn't help if the affected code isn't aware of that interface (which happens if you have old or foreign code). Sure, *new* code can handle the extended interface just fine, but old code doesn't expect it. 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 (`compat52.lua` strictly[*] _extends_ the 5.1 standard library). If you make incompatible changes you have to isolate old/foreign code somehow (which is why `compat52.strict` is separate and optional, and `compat52.mstrict` works on a per-chunk basis) ...


-- Hisham


Philipp

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