Method wrapping

Hi,

···

In message “Re: Method wrapping” on 03/11/28, “Christoph” chr_mail@gmx.net writes:

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

Oh… Is there any specific reason for that? But now you got
me wondering, are you saying then that the signatures must
match exactly (like the number of arguments with default
values, whether it’s variable-length, …)? That sounds

That was my reading of Matz announcement at least for
the arity part. Personally I don’t see a need for matching
default arguments (in fact any default arguments) since
they could be automatically supplied by the primary method
but you have ask Matz for the definite opinion.

I didn’t say anything about arity matching of method combination.
Personally, I feel like there’s no need to add explicit arity match.

						matz.

Peter wrote:

My point was about something like this:

def foo(a,b,c=3)
blah
end

def foo:wrap(a,b)
blah blah
super
end

Is foo:wrap invalid or not? If it is, I assume the following
foo:wrap is valid, right?

def foo:wrap(a,b,c)
blah blah
super
end

Either way, we loose the parameter with the default value,
either because it’s always 5 or because we always have to
specify a value. Only way is to repeat the default value in
foo:wrap. Unless there’s special behavior for wrapping
methods somewhere.

I sort of suggested the latter possibility but judging from
past record in this thread I’ll bet that Matz is going to
opt for wrapper with changing default values:-)

/Christoph