On Jun 4, 2007, at 22:57, David Flanagan wrote:
> Nobuyoshi Nakada wrote:
>> Hi,
>> At Tue, 5 Jun 2007 13:37:08 +0900,
>> David Flanagan wrote in [ruby-core:11401]:
>>> Can anyone construct two proc objects p1 and p2, without using  
>>> clone or dup, so that p1==p2 but p1.object_id != p2.object_id?
>>   p proc{} == proc{}
>>> Based on this, I would think that:
>>>
>>>    lambda {|x| x*x } == lambda {|x| x*x }
>>>
>>> But this expression return false in both ruby 1.8 and 1.9.
>> Procs have each own contexts.
>
> Okay, anything other than the degenerate case of a proc with no body?
>
> proc{0} != proc{0}
> proc{nil} != proc{nil}
>
> I still contend that the documentation gives the mistaken  
> impression that == can be used to compare the source code of the  
> bodies of two procs.

A proc is more than just its body.

If you want to compare source code bodies, use ruby2ruby.