From: Christoph (news_chr) Date: 2003-12-15T05:46:58+09:00 Subject: Re: append_features(mod) -- mod.kind_of? makes absolutely no sense T. Onoma wrote: .... > > Invokes Module.append_features on each parameter in turn. > > And under Module.append_features(aModule) is says: > > The contants and methods of aModule are added to the current module... FYI - the online PickAxe version reads as: When this module is included in another, Ruby calls append_features in this module, passing it the receiving module in aModule. Ruby's default implementation is to add the constants, methods, and module variables of this module to aModule if this module has not already been added to aModule or one of its ancestors. See also Module#include on page 345. .... > Perhaps if you just added to Module.include, Nakada's "More precisely", > > def include(*modules) > modules.reverse_each do |mod| > mod.append_features(self) > mod.included(self) > end > end > > That would make all the difference. I agree adding this Module#include implementation might be helpful - perhaps even the "privacy-aware" version (note that the Module#included hook was (afaik) never added in the 1.6 series) class Module private def include(*modules) modules.reverse_each do |mod| mod.__send__(:append_features, self) mod.__send__(:included, self) end end end /Christoph