[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Method wrapping

Christoph R.

11/27/2003 1:14:00 PM

Yukihiro Matsumoto wrote:
...
> |2. If the primary method is redefined, do the "secondary"
> methods get
> |cancelled? Or do they simply remain in place?
>
> They remain in place. They will be removed altogether when
> you remove the method using "remove_method" method.

I have asked the same this question as well and I really wish
you could reconsider this(= leave the stack hook method
stack in place).

Firstly, you pretty much have to kill this stack if the signature
of the primary method was changed since the signatures of
hook methods written for the old primary method can't be
used anymore.

Secondly, if I changed the primary leaving "pre'', "post'' and
"wrap" conditions often makes little semantic sense so they
should always be killed.

Maybe a comprise of leaving the stack in place if the signature
didn't change and killing it if the signature of primary method
Changed, or as you indicated, if the primary method was removed
altogether is most flexible approach?

/Christoph