From: Dave Thomas Date: 2001-04-04T23:26:44+09:00 Subject: [ruby-talk:13484] Re: Method and Proc equality Robert Feldt 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