From: Ilias Lazaridis Date: 2005-04-19T19:39:37+09:00 Subject: Re: [EVALUATION] - E03c - The Ruby Object Model (Revised Documentation) mark sparshatt wrote: > 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. simply rephrase to: "Object inherits from nothing" or "Object does not inherit". > The mistake you're making is that (Object) doesn't represent an instance > of Object. I understand. Thus horizontal arrows represent inheritance, too. Let's see. > It represents Object's metaclass. again my initial question: how do I access this metaclass? > Using _why's metaid library this library is irrelevant. I'm evaluating standard ruby and its Object Model. The [Meta] Object Model must be accessible without additional libraries. > Object.metaclass.superclass #=> Class output of pure ruby: irb(main):014:0> Object.metaclass.superclass NoMethodError: undefined method `metaclass' for Object:Class from (irb):14 > So the ruby documentation is correct, (Object) does inherit from Class not in my installation: I have no "(Object)" >> or >> >> correct: "(Object)"---[is-an-instance-of]--->Class > > This is correct. (Object) both inherits from and is an instance of Class. it's easier: (Object) is not existent. > >> - >> >> and finally: >> >> the diagramm gives the impression, that "Object" and "(Object)" (etc.) >> are both classes, > > Object and (Object) are both classes. "Object" and "(Object)" are essentially the same thing. >> which is of course false. There is a "definition" and an "(instance)". > > no there is a "class" and a (metaclass) there are no metaclasses in ruby. If i'm wrong: please show me the pure-ruby [no additional libraries] access-code. - The version 1.1 UML diagramm backups all my statements. You can verify it with a standard ruby installation: http://lazaridis.com/case/lang/ruby/ .. -- http://lazaridis.com