Am 13.07.2010 02:13, schrieb Stephane Payrard (via RT):
$ cat mmd.pm6
multi sub a([]) { say "[]" }
multi sub a([$i]) { say "[$i]" }
a(); a([1]);
$ perl6 mmd.pm6
No applicable candidates found to dispatch to for 'a'. Available candidates are:
:(Positional ())
:(Positional (Any $i))
in main program body at line 3:mmd.pm6
$
This is expected behaviour. Both signatures require at least one
argument, you pass in none.
If you mean to also allow no arguments at all, change your first multi to:
multi sub a([]?) { say "[]" }