Hi All, I would like to thank everyone for their illuminating examples and prose. This has cleared up understanding for me.
Thanks again, Chris On 6/23/06, Markus Laire <[EMAIL PROTECTED]> wrote:
On 6/23/06, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote: > An alternate interpretation would be that the last one is actually a compile- > time error because none of the sigs match (Int,Int) and for a call to > work with 2 Int parameters, you'd need to be explicit: > > talk(~123,3); > > But I'm not sure which way perl6 actually leans. > > Though it seems to me that automatic type conversion by the compiler is > a way to get yourself in trouble. Not that perl shouldn't let the > programmer get himself in trouble, but this seems like one of those > things that should require asking to turn on rather than asking to > turn off. Synopsis 12 at http://dev.perl.org/perl6/doc/design/syn/S12.html says <quote> When you call a subroutine with a particular short name, if there are multiple visible long names, they are all considered candidates. They are sorted into an order according to how close the actual types of the arguments match up with the declared types of the parameters of each candidate. The best candidate is called, unless there's a tie, in which case the tied candidates are redispatched using any additional tiebreaker long names (see below). </quote> IMHO that seems to mean that in my example the (String, Int) version would be called because it's "the best candidate". And that would also mean that first Int is automatically converted to String. -- Markus Laire