From: transfire@... Date: 2006-06-15T16:35:58+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Why the lack of mixing-in support for Class methods?" > on Thu, 15 Jun 2006 02:25:14 +0900, transfire@gmail.com writes: > > |Problem is that 'extend @class_extension' doesn't work unless it occurs > |_after_ the module_eval(&blk). Which means later changes to the > |extensions module will have no effect on modules that have already > |included it. Not good. So unless I've misanalyzed this, I think keeping > |a running list of extension modules, more like my previous > |implementation post, is going to be neccessary. > > It's how modules work, at least under the current implementation. > If you want/have to fix it, you should fix it all. > > | class Module > | > | def class_extension( *mods, &blk ) > | unless @class_extension > | @class_extension = Module.new > | def @class_extension.append_features( base ) > | append_features_without_extension( base ) > | end > | extend @class_extension > | end > | @class_extension.module_eval(&blk) if blk > | @class_extension > | end > > I am not going to call "extend @class_extension" for the target > module. That's not necessary, even bad from my eyes. I think this is > where our opinions differ. You mean to say you are going to eval the code directly into the target module instead? T.