From: mark sparshatt Date: 2005-04-19T16:56:27+09:00 Subject: Re: [EVALUATION] - E03c - The Ruby Object Model (Revised Documentation) Ilias Lazaridis wrote: > Christian Neukirchen wrote: > >> Ilias Lazaridis writes: >> >>> Ilias Lazaridis wrote: >>> >>> an example for wrong ruby documentation: >>> >>> - >>> >>> cmd:> ri Class >>> >>> >>> "Classes, modules, and objects are interrelated. In the diagram that >>> follows, the arrows represent inheritance, and the parentheses >>> meta-classes. All metaclasses are instances of the class `Class'." >>> >>> +------------------+ >>> | | >>> Object---->(Object) | >>> ^ ^ ^ ^ | >>> | | | | | >>> | | +-----+ +---------+ | >>> | | | | | >>> | +-----------+ | | >>> | | | | | >>> +------+ | Module--->(Module) | >>> | | ^ ^ | >>> OtherClass-->(OtherClass) | | | >>> | | | >>> Class---->(Class) | >>> ^ | >>> | | >>> +----------------+ >> >> >> I do not see what's wrong here, can you explain? > > > definitive errors: > > a) not all arrows represent inheritance, just the verticals. > > b) the relation "(Object)"---[inherits from]--->"Class" is false. > > correct: "(Object)"---[inherits-from]------->nil > As other people have pointed out this is wrong since nothing can inherit from nil, since it isn't a class. The mistake you're making is that (Object) doesn't represent an instance of Object. It represents Object's metaclass. Using _why's metaid library Object.metaclass.superclass #=> Class So the ruby documentation is correct, (Object) does inherit from Class > or > > correct: "(Object)"---[is-an-instance-of]--->Class > This is correct. (Object) both inherits from and is an instance of Class. > - > > and finally: > > the diagramm gives the impression, that "Object" and "(Object)" (etc.) > are both classes, Object and (Object) are both classes. > which is of course false. There is a "definition" and > an "(instance)". no there is a "class" and a (metaclass) -- Mark Sparshatt