On Thursday, January 23, 2003, 4:07:14 AM, Gavin wrote:

> On Thursday, January 23, 2003, 3:57:28 AM, Mauricio wrote:

>>> The logic above appears to apply, but
>>> 
>>>   A.include M
>>> 
>>> fails because "private method `include' called for A:Class".

>> You do probably already know it, but for the record, we have
>>         Object#extend (public)
>>         Module#include (private)

>> The question is why are Module#include and Module#append_features
>> private?


> Well, here's some cool code then:

... and some more:

   module M
     def hi
       "hi"
     end
   end

   class B
   end

   B.include M                # => fails: Class#include is private

   class Class
     def pub(*a)              # Because public is private, too.
       public *a
     end
   end

   Class.pub :include

   B.include M                # => succeeds

   B.new.hi                   # => "hi"


Gavin

PS. I think allowing "A.include M" would be nice.  It jars that
"extend" is allowed but not "include".  I'm not going to make a big
deal of it though.