From: Ilias Lazaridis Date: 2005-04-20T11:39:43+09:00 Subject: Re: - E03c - The Ruby Object Model (Revised Documentation) Christian Neukirchen wrote: > Ilias Lazaridis writes: > >>Jim Weirich wrote: >> >>>On Tuesday 19 April 2005 12:59 am, Ilias Lazaridis wrote: >>> >>>>>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". >>> >>>Nothing can inherit from nil, for nil is not an instance of >>>Class... as demonstrated below. >> >>you reverse things. >> >>>>>class NilSubClass < nil; end >>> >>>TypeError: superclass must be a Class (NilClass given) >>> from (irb):10 >> >>this is irrelevant. >> >>>In the context of the Ruby Object Model, Object has not superclass >>>and does not inherit from anything. >> >>it inherits from nothing, which is represented by "nil", which is a >>living' object, which is an instance of class NilClass, which inherits >>from Object. > > Dude, you drive me crazy. > > ~ruby/object.c: > > rb_cObject = boot_defclass("Object", 0); > rb_cModule = boot_defclass("Module", rb_cObject); > rb_cClass = boot_defclass("Class", rb_cModule); aah, low-level code. nice! > as you can see Object inherits from a NULL pointer, that is: > It doesn't inherit from anything. Nada. > > A NULL pointer is not nil, as you can see in ~ruby/ruby.h: > > #define Qnil 4 > > Believe it or not, but STFU, just becoming warm. .. -- http://lazaridis.com