From: "T. Onoma" Date: 2003-11-27T04:03:03+09:00 Subject: Re: Controlled block variables On Wednesday 26 November 2003 07:14 pm, ts wrote: > >>>>> "T" == T Onoma writes: > > T> class A > T> def dolittle > T> print "duck" > T> end > T> def dolittle:hook # where's the super? what do i do? > T> print "rabbit" > T> end > T> end > > only print "rabbit" Let's see... non POLS, double semantic meaning... > T> A little bigger > > T> class A > T> def dolittle > T> print "duck" > T> end > T> def dolittle:hook > T> super > T> print "rabbit" > T> end > T> end > > T> class B < A > T> def dolittle:hook # am i replacing old hook? (there's no local > dolittle) T> super # or am i supering to old hook? > T> print "fox" > T> end > T> end > > print "duckrabbitfox" How to produce "duckfox" ? > > T> Much bigger problem: a library the i don't know how it works, i'm just > using T> it: > > Don't modify library that you don't know Misses the whole point of AOP. "AOP introduces aspects, which encapsulate behaviors that affect multiple classes into reusable modules." > T> But the worst problem of all is simply that not allowing multiple wraps, > so T> severely limits the capabilities of this mechinism that it would > actually T> have no general use whatsoever. > > You must have a mechanism to change the ordering in this case (see > Allegro) and [ruby-talk:86170] Think about singletons. -t0