Kudos to all(@Larry)!

How does automatic coercion work? Like, when a routine wants a
parameter of a certain type, and is called with an argument of a
different type that C<does>

(For instance, is it something a little like this?

 multi sum ( Num $addend1, Num $addend2 --> Num ) { ... }
 multi say ( Str [EMAIL PROTECTED] ) { ... }

 class Str does Num { ... }

 class Num does Str { ... }

 say sum "3", "4";

1. C<sum()> automatically coerces its C<Str> arguments into C<Num>
parameters because C<Str.does: Num>.
2. C<say()> then automatically coerces its C<Num> arguments into
C<Str> parameters because C<Num.does: Str>.

...Or am I completely off the mark?)

Joshua Choi

Reply via email to