# New Ticket Created by  "Mark E. Shoulson" 
# Please include the string:  [perl #121117]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=121117 >


 Consider:

multi sub f1(Any $x) { "Any $x" }
multi sub f2(Any $x) { f1($x) }
multi sub f1(Rat $x) { "Rat $x" }

say f2("a");
say f2(1.9);
say f1(1.9);

This should produce

Any a
Rat 1.9
Rat 1.9

And so it does, when run from a file. But when typed in the REPL, we get

Any a
Any 1.9
Rat 1.9

i.e. the f2 call doesn't pick up the more specific f1. If you reverse the order
of the second and third sub definitions and thus define both f1's before the
f2, we get the correct results even in the REPL.

Reply via email to