lua-users home
lua-l archive

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


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"