# New Ticket Created by Zoffix Znet # Please include the string: [perl #130415] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130415 >
In this code, I would've expected the second multi to be used, since I'm not providing any named args. I'm fuzzy on whether named params affect multi dispatch, but even if they wouldn't the multi without any named params is later in the source: $ cat test.p6 multi foo($, :$) { say "there"; } multi foo($ ) { say "here"; } foo 42; $ perl6 test.p6 there A bit of a discussion here: https://irclog.perlgeek.de/perl6/2016-12-27#i_13807727 ------------------------------------------------------------------------------------- I also had this to include in the ticket, though I now see it's likely unrelated, and the throwage happens when the optimizer simply tries to work out which candidate to call during optimization stage. And the case where throwage is avoided is simply because the optimizer doesn't go far enough to actually call the multi. Including it anyway...7 If we make the multi that wasn't called above call itself with args matching no candidate: $ cat test.p6 multi foo($, :$) { say "there"; } multi foo($ ) { foo $, $; } foo 42; $ perl6 test.p6 ===SORRY!=== Error while compiling test.p6 Calling foo(Mu, Mu) will never work with any of these multi signatures: ($, $) ($) at test.p6:2 ------> multi foo($ ) { ⏏foo $, $; } Yet it still works like in the first case, if we turn off the optimizer: $ cat test.p6 multi foo($, :$) { say "there"; } multi foo($x ) { foo $x, $; } foo 42; $ perl6 test.p6 there