Francis Cianfrocca wrote:
> How about "included" instead of "instantiated"?

Defining SomeModule.included already does something quite different, so
it would be confusing to define Module#included.

Anyway, I think what he wanted was a callback that fires not when a
module is included, but when ruby evals this code:

module Foo
end

You can get this behavior for classes rather than modules: you get a
callback that fires for

class Bar
end

by defining the Class#inherited method (a global definition, with all
the inherent dangers), since Bar inherits (implicitly) from Object.

> On 5/23/06, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
>>
>> Hi,
>>
>> In message "Re: [OT] Re: initializing instance variables in a module"
>>
>> |the other day i realized that one could detect class creation using
>> |
>> |   class Class
>> |     def inherited
>> |       ...
>> |     end
>> |   end
>> |
>> |but that no such hook existed for class Module.  could one be added such
>> as
>> |
>> |   class Module
>> |     def instantiated
>> |       ...
>> |     end
>> |   end
>> |
>> |to hook into rb_define_module/rb_define_module_under?
>>
>> I am not sure what situation that kind of method is useful.  But in
>> any case I don't feel the word "instantiated" is the right word for
>> the method.  Note that I am not opposing the method itself.
>>
>>                                                         matz.
>>
>>
> 


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