Klaas-Jan Stol wrote:
I guess you're right :-) I was thinking of ambiguity, like

sub foo :multi(Integer, Integer)
 .param pmc i :invocant
 .param pmc j
 .param pmc k :invocant
end

sub foo :multi (Integer, Integer)
 .param pmc j :invocant
 .param pmc k :invocant
end

but I guess parrot will see that the other foo has 2 parameters while the
first has 3, and make the selection based on that

Like :optional, the :invocant parameters must all be contiguous. So, only the second of those is valid, though you can have as many non-:invocant parameters as you like after the last :invocant parameter. Also, :invocant parameters can't be :optional.

BTW, :invocant looks a bit like ".invcant", which is also a directive. Can
that confuse people?

Do you mean ".invocant"? They are related concepts, as .invocant sets the single invocant of a method call, while :invocant tells a multisub/method to treat a set of parameters as invocants. Any .sub marked with :method and :multi always treats the method invocant as if it was marked with :invocant, even though it isn't retrieved with .param.

We might want to consider adding a standard prefix to .invocant, as well as to .arg, .result, etc, to make it clear that they're a group of directives all combined to make a single PCC call.

Allison

Reply via email to