From: Arlen Cuss Date: 2008-02-29T10:45:41+09:00 Subject: Re: constants defined in Kernel are also defined in Object? ------=_Part_20945_14888295.1204249547777 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Fri, Feb 29, 2008 at 12:11 PM, Arlen Cuss wrote: > The reason for that is since the top level namespace *is* an Object. > Just to clarify everything else, this is the reason why they're available on every object. `Functions' defined on the top-level are actually *instance methods of Kernel*. This means that they're *included* as instance methods of Object, and hence of *every* object. Since Kernel is itself an Object, and it has a metaclass which is by all means an Object, this means you can even access them on Kernel as if they were module methods. Or any other object. >> def hi >> puts "hi!" >> end => nil >> (class << Kernel;self;end).hi hi! => nil >> Kernel.hi hi! => nil >> hi hi! => nil >> 42.hi hi! => nil >> Arlen ------=_Part_20945_14888295.1204249547777--