On Fri, Feb 29, 2008 at 08:48:50AM +0900, Arlen Cuss wrote:
> 1. Foo is an instance of Object [eventually].
> 2. Object mixes in Kernel.
> 2.a. Kernel's constants are Object's too.

Apparently all constants of modules mixed into Object belong to Object:

irb(main):001:0> module M; FOO = 42; end
=> 42
irb(main):002:0> class Object; include M; end
=> Object
irb(main):003:0> class Foo; end
=> nil
irb(main):004:0> Object.const_defined?(:M)
=> true
irb(main):005:0> Foo.const_defined?(:M)
=> false

The culprit:

variable.c:1420        if (!recurse && klass != rb_cObject) break;

> 3. Foo::SOME_CONST will see through to Object::SOME_CONST and then
> that to Kernel::SOME_CONST.
> 
> Correct me if I'm wrong in some detail.