Gregory Seidman wrote:
> On Fri, Feb 29, 2008 at 02:17:33AM +0900, Paul Brannan wrote:
>> This seems peculiar to me:
>>
>> cout@bean:~/tmp$ ruby -e 'module M; FOO = 42; end; class Foo; include M; end; p Foo.const_defined?(:FOO)'
>> false
>> cout@bean:~/tmp$ ruby -e 'Kernel.const_set(:FOO, 42); p Object.const_defined?(:FOO)'
>> true
>> cout@bean:~/tmp$ ruby -e 'Kernel.const_set(:FOO, 42); p Class.const_defined?(:FOO)'
>> false
>>
>> Is there a reason for this behavior?
> 
> % ruby -e 'p Object.ancestors'
> [Object, Kernel]
> %
> 
> Kernel is included by Object.

And M is included by Foo, yet the analogy breaks down in the outputs of

  Object.const_defined?(:FOO)

  Foo.const_defined?(:FOO)

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407