callsame
ErrorsCollection

callsame

Synthesised documentation from language/functions

From language/functions

See Original text in context

callsame calls the next matching candidate with the same arguments that were used for the current candidate and returns that candidate's return value.

proto a(|) {*}
 
multi a(Any $x{
    say "Any $x";
    return 5;
}
 
multi a(Int $x{
    say "Int $x";
    my $res = callsame;
    say "Back in Int with $res";
}
 
a 1;        # OUTPUT: «Int 1␤Any 1␤Back in Int with 5␤»