On Sat, Feb 23, 2008 at 5:23 PM, Eric Mahurin <eric.mahurin / gmail.com> wrote:
>  I don't agree with the title

Like I said at the beginning of the article, neither do I ;-)

>  * adding new (or perceived missing) functionality (methods) to a class.  The
>  traditional solution would be to just inherit from the class and use the
>  derived class instead where you want this new functionality.  Since you
>  can't inherit from some classes (i.e. immediates, a problem with the
>  language IMHO), you can instead use something like Forwardable instead.

Indeed.  The irony here is that Ruby is perhaps the easiest language
in the world to implement delegation in.  I'm planning on writing a
series of posts on alternatives to monkey patching, and delegation is
going to be one of the first techniques I talk about.

>  Every case I thought that I needed "monkey patching", I've found a
>  relatively simple solution.  I usually only do monkey patching in the
>  following cases which have no reuse: top-level script, testing, and quick
>  hacking.

Quite.  I have no objection to monkey patching in those contexts,
assuming that it really IS the easiest solution.

Thanks for the reply!

-- 
Avdi