From: matz@... (Yukihiro Matsumoto) Date: 2003-11-27T18:28:31+09:00 Subject: Re: Method wrapping Hi, In message "Re: Method wrapping" on 03/11/27, "T. Onoma" writes: |I would like to point out that their is some inconsistentcy in this behavior, |in that def behaves differently depending on whether it is defined in class |augmentation or a subclass. | | class A < X | def riot | super | print "P" | end | end | | class A | def riot # this redifines | super | print "R" | end | end | | class B < A | def riot | super # this wraps | print "W" | end | end | |The def syntax is the same but each has different semantic meaning (effects |code readability/code maintainence). I don't get your point. Perhaps your example should be: class A < X def riot print "P" end end class A def riot # this redifines print "R" end end class B < A def riot super # this wraps print "W" end end Right? |It is important to understand that Ruby already has a wrapping facility using |subclasses. And singletons act similiarly. So it would be more consistent to |naturally extend that to in-class wraps. We can do this without having to add |special syntax sugar (the colon). But how? I don't see concrete syntax you are saying. matz.