From: Bernhard Weitzhofer Date: 2003-05-14T19:40:32+09:00 Subject: Re: Scope of modules and classes Hi dblack@superlink.net wrote: >>Is there a better way, should I stick to the "M::"s, or is it just bad >>design that I am doing here? > > Looking at the design aspect of it, you could put M2 inside M (since > it seems to want to be there :-) if it makes sense in the larger > picture. > > module M > class K1 > end > > class K2 > def initialize > puts "Initializing a #{self.class}!" > end > end > > module M2 > class K3 < K1 > def initialize > @a = K2.new > end > end > end > end > > include M > M2::K3.new The original idea was to build a toolkit (module M). Module M2 should have only used this toolkit rather than being part of it. But after some reconsideration, I think it would have been a little paradox to encapsulate the classes of module M just to virtually give this encapsulation away again by making them accessible from outside (from module M2) -- so I think I will implement the scheme you suggested and consider module M2 a "plugin" for toolkit M ... thanks for your help, Bernhard Weitzhofer