From: "Mean L." Date: 2012-11-04T08:36:52+09:00 Subject: Re: why does UnboundMethod need to remember the class it was retrieved from (not merely owner)? Ryan Davis wrote in post #1082683: > On Nov 3, 2012, at 16:30 , Mean L. wrote: > >> to wait for an answer instead of repeating, "it's the rule". >> >> AFAICT it should be sufficient to test that the object you are binding >> to is_a?(owner) (Base.new.is_a?(sub_foo.owner)) >> >> This would also make base_foo and sub_foo equal as they refer to the >> same foo in base. > > Unfortunately, the answer really is because "it's the rule". > > The slightly longer answer is "because Matz is worried we'll try to bind > a C method (eg Array#join) to a different class and cause a crash". I am not following this logic. Binding a method to an object that is_a? method's owner, should be completely safe, there is no danger of crashes. I think you are thinking of an even looser (duck) binding, which may have merits, but it's not what I am asking about. -- Posted via http://www.ruby-forum.com/.