From: "David A. Black" Date: 2007-10-24T07:05:52+09:00 Subject: Re: terminology: class methods versus kernel methods Hi -- On Wed, 24 Oct 2007, Thufir wrote: > On Oct 23, 2:45 pm, "Rick DeNatale" wrote: > [...] >> print is an instance method of the Kernel module. >> >> The Object class includes Kernel, so the instance methods of Kernel >> are effectively instance methods of every object, at least in Ruby >> 1.8. > [...] > > Kernel is a class, sub-class, of Object? Kernel is a module. Object mixes it in -- essentially: class Object include Kernel end so that every instance of Object, or a subclass of Object, gets access to the instance methods defined in Kernel. Of course, the module Kernel is, itself, an Object :-) You'll find that if you look closely at the top of the object tree in Ruby, there are some circularities: - Kernel is a Module - Module is a Class - Class is a subclass of Module - Object is a Class - Class is an Object etc. Don't worry about it, though. The reason there's circularity at the top of the object tree is so that the rest of the object tree -- i.e., everything you really need to do -- makes sense. David -- Upcoming training by David A. Black/Ruby Power and Light, LLC: * Advancing With Rails, Edison, NJ, November 6-9 * Advancing With Rails, Berlin, Germany, November 19-22 * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details!