Bob Rogers <[EMAIL PROTECTED]> wrote:

> What if one wants the first and third arguments to be the invocants?
> Then the first syntax gives

>        .sub foo @MULTI
>          .invocant Integer a
>          .param pmc b
>          .invocant String c

That should better be

>        .sub foo @MULTI
>          .invocant Integer a
>          .invocant pmc b
>          .invocant String c

Invocants are positional arguments, there isn't a case where the first
and the third are invocants in a Perl6 function signature. It of course
boils down to the same, namely that the second argument is a wildcard
(Perl6 Any) but it's for the dispatcher nethertheless a dispatch on
three invocants.

> But it's not as obvious how to do that for the second one, unless you
> use "pmc" as the explicit type name for "any":

>        .sub foo multi(Integer, pmc, String)
>        .param pmc a
>        .param pmc b
>        .param pmc c

> In that case the first syntax strikes me as cleaner . . .

I'm not sure. But there is still another thingy. A12 allows multiple
colons to separate invocant "classes". If there is a tie, the secondary
invocants are used as tie breakers, which could be written as:

      .sub foo multi(Integer, pmc: String)
         .param pmc a
         .param pmc b
         .param pmc c

- try to dispatch on the first two types in the first place
- if there is a tie, consider the type of the 3rd argument

leo

Reply via email to