On Sat, Dec 27, 2008 at 4:17 PM, Yaser Sulaiman <yaserbuntu / gmail.com> wrote:
> According to Wikipedia, a monkey patch[1] is:
>
>> a way to extend or modify the runtime code of dynamic languages [...]
>> without altering the original source code.
>
> The following statement from the same entry confused me:
>
>> In Ruby, the term monkey patch was misunderstood to mean any dynamic
>> modification to a class and is often used as a synonym for dynamically
>> modifying any class at runtime.
>
> I would like to know the exact meaning of monkey patching in Ruby. To be
> more specific, I would like to know the answers to the following questions:
>
> 1- What does "runtime code" refer to in Ruby?
>
> 2- Are "monkey patching" and "open classes" different terms for the same
> thing?
I guess this is the critical point why the Wikipedia article says
"misunderstood"
as in Ruby even core classes are open MP just does not really mean
anything else for core classes
and your own classes or any other imported classes.
>
> 3- Is the following considered as monkey patching, or is it something else?
>
> class String
>  def foo
>    "bar"
>  end
> end

I would  consider it MP
> Regards,
> Yaser Sulaiman
>
> P.S. I originally posted this question on stackoverflow[2]. There are some
> good
> answers over there, but I'm still kinda confused. I hope that someone in the
> Ruby
> community can clarify this issue for me.
Hopefully ;)
Cheers
Robert
>
> [1]: http://en.wikipedia.org/wiki/Monkey_patch
> [2]:
> http://stackoverflow.com/questions/394144/what-does-monkey-patching-exactly-mean-in-ruby
>



-- 
Il computer non una macchina intelligente che aiuta le persone
stupide, anzi, una macchina stupida che funziona solo nelle mani
delle persone intelligenti.
Computers are not smart to help stupid people, rather they are stupid
and will work only if taken care of by smart people.

Umberto Eco