On Fri, Feb 01, 2002 at 06:23:56AM +0900, Paul Brannan wrote:
> On Wed, Jan 30, 2002 at 08:56:07AM +0900, Yukihiro Matsumoto wrote:
> > Visible constants are:
> > 
> >   * constants defined in the class/module.
> >   * constants defined in the outer class/module.
> >   * constants defined in the ancestors.
> 
> Here's a problem related to the original poster's problem.  When I do
> this:
> 
>   module Config
>     A = 1
>   end
> 
>   module Config2
>     include Config
>     A = 42
>   end
> 
>   class Foo
>     include Config2
>     def initialize
>       p A
>     end
>   end
> 
>   Foo.new
> 
> I get 42.  But when I do this:
> 
>   class Bar
>     def initialize(t)
>       extend(t)
>       p A
>     end
>   end
> 
>   Bar.new(Config2)
> 
> I get an exception.  Is Config2 not one of Bar's ancestors?
> 
> Paul
> 

hmm.. include is different from extend.
One of the key differences is that extend adds instance methods and include adds constants and methods -- at least according to my understanding.

-- 
Alan Chen
Digikata LLC
http://digikata.com