On Sat, Feb 15, 2003 at 08:23:46AM +0900, Chris Pine wrote: > While this may be of interest to no one but myself, there is one subclass of > Class after all! `osc' stands for Object Singleton Class... > > > irb(main):001:0> osc = class << Object; self; end > #<Class:Object> > irb(main):002:0> osc.class > Class > irb(main):003:0> osc.superclass > Class >> osc = class << Object; self; end => Class >> osc.id => 538076786 >> osc.superclass.id => 538076796 >> Class.id => 538076796 >> class << Class; self; end.id => 538076766 >> class << Class; self; end.superclass.id => 538076776 >> class << Class; self; end.superclass.superclass.id => 538076786 >> class << Module; self; end.id => 538076776 >> Class.public_methods.find {|x| x == "new" } => "new" >> Class.singleton_methods.find {|x| x == "new" } => "new" So Class is at the top of the singleton classes' inheritance chain. Interesting loop Class ^ Object --> Object' ^ ^ Module --> Module' ^ ^ Class --> Class' > > Interestingly, it means that we can (sort of) instantiate the singleton > classes of any class: > > irb(main):004:0> osc.new > #<Class:0x400d4404> As you wrote in your other mail this doesn't work. But I don't see the need for it (even for fun) as we can clone the object with its singleton and all... -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com <james> Are we going to make an emacs out of apt? APT - Debian in a program. It even does your laundry -- Seen on #Debian