On Thu, 2004-05-06 at 02:36, Dov Wasserman wrote: > After the New And Improved logError() routine is rolled out, it seems to me > that this log statement should generate a compile-time error, since the > named Int parameter "prio" is given a non-integer argument "HIGH". At best, > this should be a run-time error. Either way, this confusion undermines a key > Perl strength: ability of the user to upgrade code (without breaking it).
I strongly disagree. this fact has nothing to do with Perl itself, but with how you decide to use it. you said "Int +$prio" because you *wanted* code to break when "prio" is not an integer. we have to cope with new (and greater) strenghts in Perl6, and one of these is: "it's fine for Perl to have a type system as long as it's optional" (cit. A6). if you upgrade your code to do type-checking, it obviously fails when type constraints are violated. but you don't have to. you could have said: sub logError($msg, +$prio = 4, *%errorInfo) { # ... my Str $prio_desc = getPrioDescription($prio) // $prio; print "$prio_desc: $s.\n"; } or even: my Str $prio_desc = $prio; if $prio.isa(Int) { $prio_desc = getPrioDescription($prio); } cheers, Aldo