[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules)
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 17 Apr 2014 15:43:04 +0200
On Thu, Apr 17, 2014 at 3:30 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
> Yes, but you usually don't call a function to get an error. The error is a
> symptom that the function couldn't complete its task. If you patch the
> function to succeed in more cases, that seems like a win-win, doesn't it?
Ah, so you don't mean replacing "nil,err" with "raises err" - that's
better. However, still think that static reasoning about code is
easier when the functions all stay still and don't change according to
context...
> That's the `type` case, where you would return something other than the
> eight basic type names (which would mess up dispatching),
Just checked, I've got utils.type - but it always returns a string.
Seemed more consistent to me (assumes that MT may have a _name field)
> realized that those cases are a red hering anyway, because even if those
> patches are more or less compatible with legacy code, there could still be
> conflicts if you have two (or more) monkey-patchers.
Yes, these problems scale exponentially with monkey number...big
reason why the default answer to "should I monkey-patch?" should be
"not yet"
- References:
- Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), steve donovan
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Hisham
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Dirk Laurie
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Hisham
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Philipp Janda
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), steve donovan
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Philipp Janda
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), steve donovan
- Re: Monkey Patching is Bad, Unless Really Needed (was Re: A guide to building Lua modules), Philipp Janda