From: Austin Ziegler Date: 2005-04-05T23:05:28+09:00 Subject: Re: [EVALUATION] - E03b - The Ruby Object Model On Apr 5, 2005 8:34 AM, Ilias Lazaridis wrote: > The existing documentation seems at least missleading, if not > wrong: It's neither misleading nor wrong. It is complex. > this can be drawn like this: > i've played within IRB, but: > I cannot access any of the metaclasses > the same in the documentation: no metaclasses puts Class.id # => 20927668 puts class << Class; self.id; end # => 20927632 puts Object.id # => 20927692 puts class << Object; self.id; end # => 20927656 The class "Class" has an object ID that is different than its metaclass. The same with class "Object". Objects, too, can have metaclasses, like: foo = Object.new puts foo.id # => 22734748 puts class << foo; self.id; end # => 22725040 I've modified your diagram; ocObject* is an instance of otherClass, and the (ocObject)* metaclass is the metaclass for this instance, and it is a different metaclass than any other instance of otherClass. ocObject*---->(ocObject)* | | | | v v otherClass--->(OtherClass) | | | | v v Object--->(Object) ^ ^^ | || | / | | / | | / | | / | Module--->(Module) ^ / ^ | / | |/ | Class---->(Class) -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca