From: "T. Onoma" Date: 2003-11-27T15:38:59+09:00 Subject: Re: Method wrapping On Thursday 27 November 2003 04:00 am, Hal Fulton wrote: > Since I have already opened this issue, I will clarify by asking > two more specific questions: > > 1. If I want to redefine a "secondary" method (or whatever I should > call it), can I do so? It seems that an attempt to redefine > foo:pre would simply add a new foo:pre. I doubt we should be able to redine secondary methods. If you do this they will have to be indexed in someway, and a means for referencing those indexes becomes neccessary. Because the indexes have no semantic value, they would not be generally usable. For example, if I had a class using 3 wraps, and you created a subclass of it that redinfined wrap #2, if I later "improved" my class by placing another warp before #2, your subclass would no longer work. (Similiar to below) > 2. If the primary method is redefined, do the "secondary" methods > get cancelled? Or do they simply remain in place? Using just def to redefine method will neccessarily destroy all wraps otherwise, you run into this: class A # An external library class def riot print "P" end end class B < A # My subclass def riot print "Q" end end If later, the library maintainer decided to add an AOP method: class A # An external library class def riot print "P" end def riot:wrap print "*" end end B class will no longer work as expected. -t0