From: Robert Klemme Date: 2004-03-02T19:04:49+09:00 Subject: Re: UnboundMethod#hash apparently broken in 1.8.1 "Yukihiro Matsumoto" schrieb im Newsbeitrag news:1078185421.621148.19179.nullmailer@picachu.netlab.jp... > Hi, > > In message "Re: UnboundMethod#hash apparently broken in 1.8.1" > on 04/03/02, Mark Hubbart writes: > > |To me, at least, this behavior is unexpected. I would expect it to > |return the same object each time; or at least objects with the same > |hash value. > > I think you're expecting too much. ;-) > I'm curious why you expect so. At least both UnboundMethod instances refer the same instance method, i.e. the same thing if you like. So if put into a Set or Hash (as key) I'd expect them to be treated as equivalent. Is there a reason why they shouldn't? Can they be in a state where they no longer refer the same method? AFAIK UnboundMethod#bind returns a new instance: irb(main):001:0> class Foo;def bar;end;end => nil irb(main):002:0> m=Foo.instance_method :bar => # irb(main):003:0> f=Foo.new => # irb(main):004:0> x = m.bind f => # irb(main):005:0> m => # irb(main):006:0> m.id => 135031972 irb(main):007:0> x.id => 135021280 irb(main):008:0> Kind regards robert