lua-users home
lua-l archive

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


On 15 April 2013 10:43, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Mon, Apr 15, 2013 at 10:34 AM, Pierre Chapuis <catwell@archlinux.us>
> wrote:
>>
>> These issues are not imaginary, they are real, they happen when you make
>> large scale programs. I am not even talking about modules that abuse the
>> fact that some modules expose globals to monkey-patch them and do it
>> wrong: https://gist.github.com/catwell/3803669
>
>
> Ouch!  That is most definitely a fail.  To burden a person working on their
> own complex problem with that kind of module issue is not fair.
>
> The first law of monkey-patching is "Don't". The second is .. "Not yet...".
>
> I'd say that module developers work under special constraints, in order to
> allow their users to relax and do whatever monkey-patching _they_ desire to
> do!   A library writer does extra work, so that the users don't have to.

Heh, we've been considering for a while a helper library in Prosody,
available to plugin authors, specifically to aid with monkey-patching
:)

People can and will do it anyway. It often breaks things - for example
reloading plugins must clean up after themselves, which is not hard to
do (just restore the original function), but when you have multiple
layers of monkey-patching the same 'victim' function (I've only seen
it once!) things get weird...

So as evil as it is, if we were to make a helper library that
magically made everything work as expected, surely that's at least an
improvement? :)

Regards,
Matthew (who, chuckling while he wrote, probably made more than a
dozen people cry out at this mail)