From: dblack@... Date: 2007-06-27T07:38:05+09:00 Subject: Re: Error in ancestor? Hi -- On Wed, 27 Jun 2007, Robert Dober wrote: > On 6/26/07, dblack@wobblini.net wrote: > >> The thing is, there's one big difference that's not just a matter of >> implementation: singleton classes of Class objects are the only ones >> that can actually be called by more than one object (the class, plus >> its descendants). > I am definitely lost here, what do you mean by "can be called", their > methods of course, ok so that is exactly what I meant, it is the > "outside world" that makes the difference. I meant the inheritance situation: class C def C.x end end class D < C end D.x # D calling C's "singleton" method (which is therefore # not really singleton, because more than one object can # execute it). > It is not the "fault" of the Singleton Class that it does not inherit > from Module, could we imagine the following e.g.: > > s="a" > t=class< def hi; 42 end > self > end > c = Class.new{ include t } > > BTW I wanted just to be sure that this and some other tricks do not > work and they don't :-( > But Ruby threw a "Virtual Class" to me, actually did we discuss this > name?, I quite like it. I don't. (class << ""; self; end).is_a?(Object) # => true Nothing "virtual" about it :-) David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)