Robert Feldt <feldt / ce.chalmers.se> writes:

> On Wed, 4 Apr 2001, Dave Thomas wrote:
> 
> > Neither class Method nor class Proc implement '==', so it defaults to
> > Object's version of ==, which tests based on object identity.
> > 
> Yeah, but I guess you could ask why the identities are not the same. I
> know the low-level reason (mnew creates a new Method object for each call
> to method and thus different identities) but is there a deep reason for
> this behavior? Maybe add some way to get to the identity of the underlying
> block called?

Would the identity be based on the method name, or the method
semantics (given that you can redefine methods). I suspect this would
be a tricky thing to implement.

   class Dave
     def meth
       puts "hello"
     end
   end

   d = Dave.new
   m1 = d.method(:meth)

   def d.meth
     puts "goodbye"
   end

   m2 = d.method(:meth)

   m1 == m2 ???



Regards

Dave