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:
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
Synopsis 12 at
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).
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.