From: ara.t.howard@... Date: 2006-11-08T13:23:28+09:00 Subject: Re: Can't bind a singleton method to a subclass? On Wed, 8 Nov 2006 dblack@wobblini.net wrote: > I think it's not so much that you're unbinding it *from* B, as that you're > grabbing it *through* B. So, by the time you unbind it, it doesn't "know" > that you got it that way; it's just a Method object, and it allows itself to > be unbound. yeah. at first i thought that, but: harp:~ > cat a.rb class A def self.class_method() 42 end end class B < A; end p A.method(:class_method) p B.method(:class_method) harp:~ > ruby a.rb # # so it seems like the method is aware that it's receiver is B. but i take your point. > I'd say that's a side-effect of the fact that A's singleton > methods can be got at via B at all. yes. put another way, and something i was be-moaning several years ago, is this: harp:~ > cat a.rb class A SINGLETON_CLASS = class << self self end end class B < A SINGLETON_CLASS = class << self self end end p B::SINGLETON_CLASS.ancestors harp:~ > ruby a.rb [Class, Module, Object, Kernel] singleton classes should respect inheritence. regards. -a -- my religion is very simple. my religion is kindness. -- the dalai lama