On Tue, 23 May 2006, Yukihiro Matsumoto wrote:

> I am not sure what situation that kind of method is useful.

   harp:~ > cat a.rb
   class Class
     WRAPPER = []
     def inherited other
       wrapper = WRAPPER.first
       wrapper.const_set other.name.split(%r/::/).last, other if wrapper
     end
     def load file, m
       wrapping(m){ ::Kernel.load file, wrap = true }
     end
     def wrapping m
       WRAPPER.push m
       yield
     ensure
       WRAPPER.pop
     end
   end

   m = Module.new

   Class.load 'b.rb', m

   p m::C
   p C


   harp:~ > cat b.rb
   class C; end


   harp:~ > ruby a.rb
   #<Module:0xb75cb50c>::C
   a.rb:24: uninitialized constant C (NameError)


i'd like to do the same for modules.


> 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.

   how about #inherited then?

     harp:~ > ruby -e'  p Module.new.is_a?(Module)  '
     true

   or perhaps #defined

   or perhaps #created


regards.

-a
-- 
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama