Jim Freeze wrote: > * Florian Frank <flori / nixe.ping.de> [2005-07-26 08:26:21 +0900]: > > >>class B >> def f; :g;end >>end >>class B >> include Mod >>end >>B.new.f # => :g > > > Thanks Forian. For some reason I always thought that including a mod > would shadow old methods. > I suppose for my method to work (no pun intended), the standard > operating procedure is to: > > class B > alias :_orig_f > remove_method :f > include Mod > end > > I'm a little slow in getting around to these types of things, I'm > surprised I haven't seen an RCR to reduce this to a single line. Including a module is just like inheriting from a class--the module is above you in the ancestor list. I guess the intuitive meaning of "include" might be different--one might think it meant "define all methods from the module at this point in my class definition". Maybe "inherit <module>" would be a better name for the construct... So would the RCR be for a construct that inserted a module between each instance of B and B itself?