From: Ryan Davis Date: 2012-11-04T08:25:33+09:00 Subject: Re: why does UnboundMethod need to remember the class it was retrieved from (not merely owner)? On Nov 3, 2012, at 16:30 , Mean L. wrote: > Igor Pirnovar wrote in post #1082666: >> Mean L. wrote in post #1082655: >> >>> This does not answer the question. >> >> How comes? > > Because "it's the rule" is a not a meaningful answer to why? > > If you don't know why, that's ok, neither do I, that just means you need > 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've proposed the change that gets rid of "the rule" and it got shot down with this explanation. Why we can't just say that the rule is only in effect for C methods is beyond me. I think it'd be a fantastic change to allow for agent / prototype-based / genetic programming.