[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 9:46:00 PM

Peter wrote:
...
> > You realize that you on are speculative grounds claiming that these
> > circumstances will be rare enough. One of the more common method
> > redefining circumstances are probably (this base on other evidence
> > but my gut feeling:-) are of the form
> >
> > def meth(a,b,c,new_parm = some_default_value)
> > ....
> > end
>
> def meth:wrap(a,b,*args)
> do_something(a, b)
> super
> end

This will probably be illegal since wrapper arity differs from
the primary arity.

>
> This WORKS for constructors. Really. And they are a kind of
> wrappers as Tom pointed out. Unless you'd give b a default
> value too...

...
> > an arity altering way would render the class unusable if the hooks
> > weren't removed. Being forced to use reflection features to remove
> > the hooks is NOT suitable for beginners and I wouldn't want to be
> > bothered (perhaps because I never grew nor ever will grow out of
> > beginner-tum:-) with this either.
>
> There you've got a point. But removing the wrappers could
> also break other code, no? Unless you only put code in those

This breakage isn't as bad - it is "only" a semantic one.

> wrappers that are not needed for correct execution...

/Christoph