sub callsame

Documentation for sub callsame assembled from the following types:

language documentation Functions

From Functions

(Functions) sub callsame

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␤»