From: Saynatkari Date: 2005-04-19T14:45:31+09:00 Subject: Re: - E03c - The Ruby Object Model (Revised Documentation) Le 19/4/2005, "Ilias Lazaridis" a �crit: >Jim Weirich wrote: >> On Monday 18 April 2005 11:34 pm, Ilias Lazaridis wrote: >> >>>>There is another evident mistake in your UML diagram. Object doesn't >>>>inherit from nil, nil is a literal and an instance of NilClass which >>>>inherit from Object. >>> >>>you are wrong: >>> >>>irb(main):001:0> Object.superclass >>>=> nil >> >> The documentation for superclass clearly states that it returns the superclass >> of its target, or nil. >> >> In this case it returns nil because Object does not have a superclass, i.e. it >> does not inherit from anything. > >In context of an Language Object Model: > >Object inherits from "nil". Er, no. Object does not inherit. As was pointed out to you, #superclass just happens to return nil to signify there is no superclass. >"nil" is represented by an _instance_ of class "NilClass". > >I've drawn this instance "nil" into the diagram. > >[possibly it will be removed with the next revision] > >- > >Nil is a terribly confusing topic, thus I would prefere to keep is out >of the currect topic. Why is it confusing? nil is 'nothing'. >You can review an old thread about smalltalk's Nil: > >comp.lang.smalltalk > ST - The Loneliness of Nil >http://groups-beta.google.com/group/comp.lang.smalltalk/msg/f7f017a49e6268 >http://lazaridis.com E -- template void quack(duck& d) { d.quack(); }