On Mar 13, 2008, at 4:20 PM, Robert Klemme wrote: > Using a Struct generated class as base class is a bad example IMHO > because those classes do already have the equation properties. heh - yeah bad example. i just used struct to avoid defining atts 'a' and 'b' and an initializer - i think the example stands with that though. > At the moment the only advantage I see in using modules is avoidance > of namespace pollution. Personally I'd just have a method in class > Module equate_on which defines methods as shown. well namspace pollution is no small thing! the other huge advantage is that running rdoc over something like class C module ClassMethods end end is about a billion times better than running it over class C singleton_class.module_eval .... not to mention grep et all. the other huge advantage of using modules is subtle: if you start out with code such as module M def self.included other add_equate_method_to other end end and, over the course of your project end up with module M X = 4 Y = 2 end then the result of class C include M end is that X and Y are dumped into C *even though the included block was purposely setup to define what happens logically for module inclusion*. by carving out the target of inclusion one can do module M module Methods end def self.included other other.extend Methods end end and dump constants into M to your heart's content without inadvertently dumping them into every class that wanted a little class method. this last bit i just recently have been using - but born out from long debugging session ;-) cheers. a @ http://drawohara.com/ -- sleep is the best meditation. h.h. the 14th dalai lama