From: Robert Klemme Date: 2008-06-19T22:41:34+09:00 Subject: Re: Why metaclasses? 2008/6/19 James Coglan : > So anyway, this question has been really bugging me: in Ruby, how come > metaclasses are just that: classes? Given that you cannot instantiate them, 13:32:55 OPSC_Gold_bas_dev_R1.2.2$ irb Ruby version 1.8.6 irb(main):001:0> x = Class.new => # irb(main):002:0> o = x.new => #<#:0x7ff9b56c> irb(main):003:0> o.class => # irb(main):004:0> o.class == x => true irb(main):005:0> x === o => true irb(main):006:0> y = Class.new x => # irb(main):007:0> y.superclass => # irb(main):008:0> y.superclass == x => true irb(main):009:0> u = y.new => #<#:0x7ff77518> irb(main):010:0> x === u => true irb(main):011:0> y === u => true irb(main):012:0> m = Module.new => # irb(main):013:0> y.class_eval { include m } => # irb(main):014:0> m === u => true irb(main):015:0> y.ancestors => [#, #, #, Object, Kernel] irb(main):016:0> > is there any reason why they need to be classes instead of just modules? I > want this release to be as close to Ruby as possible so if I've seriously > misunderstood something I'd rather be put right. See above. :-) Kind regards robert -- use.inject do |as, often| as.you_can - without end