From: yolanda washington Date: 2011-02-14T03:45:18+09:00 Subject: Re: DCI and ruby unsubscribe ----- Original Message ---- > From: Michel Demazure > To: ruby-talk ML > Sent: Sun, February 13, 2011 10:26:03 AM > Subject: Re: DCI and ruby > > Andrew Wagner wrote in post #981397: > > Hm, interesting question. Can you give an example of when you might need > > to > > un-assign a role? It only lasts for the length of the request anyway, if > > I > > understand correctly. > > I was thinking in general terms, not in a Rails setting. Just thinking > about how the DCI idea could be useful in my work, as it seems very > ruby-esque (duck typing > classing). > > I can imagine cases where the given class has a given instance method, > say :foo. The object is assigned a role where the :foo method is > redefined. Then you assign a new role, which uses the generic :foo > method and you want it back. > > If you use mix/unmix, then when you assign (= mix) a role, you have to > know if you have an already mixed-in role to unmix and which one. You > need to distinguish two types of mixins, permanent and temporary. Just a > small addition to the mechanism indeed, unless you want to mix (!) > things (including/excluding in roles or vice versa). Difficult to say > more without real examples. > > Has this question something to do with the 'refinement' proposal ? > > _md > > -- > Posted via http://www.ruby-forum.com/. > >