From: dblack@... Date: 2006-08-25T03:23:36+09:00 Subject: Re: Call functions of superclass Hi -- On Fri, 25 Aug 2006, Nathan Smith wrote: >> I think you're adding an extra level of reference or indirection or >> something. Look at this: >> >> irb(main):001:0> class C; object_id; end >> => 1615634 >> irb(main):002:0> C.new.class.object_id >> => 1615634 >> irb(main):003:0> C.new.class.superclass.object_id >> => 1683084 >> irb(main):004:0> C.new.class.superclass >> => Object >> irb(main):005:0> Object.object_id >> => 1683084 >> irb(main):006:0> class << C; object_id; end >> => 1615554 >> >> As you can see, the singleton class of C is not the same object as >> either C or the class of C. >> >> ("Singleton class" is the most general term; the Pickaxe uses >> "metaclass" to mean singleton class of a Class object. I tend to just >> use "singleton".) > > I concede your point -- I was using singleton as the object-specific > class, while it is the opposite of that. Thanks for the clarification. > Maybe now my arguments will make more sense! It doesn't sound like I clarified it.... :-) The singleton class *is* the object-specific class. Here's a common idiom that illustrates it: class Object def singleton_class class << self self end end end It sounds like this came out backwards -- ? David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.