On Wed, 2004-05-05 at 22:36, Dov Wasserman wrote:

> sub logError($msg, Int +$prio = 4, *%errorInfo) {
[...]
> logError("Database error", module => "DB.pm", line => 263, prio => "HIGH");
> 
> 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.

Ok, stopping there... I'm not sure I know why that would be the case.
It's certainly valid Perl 6 (as far as I know) to say:

        my Int $foo = "bar";

though at run-time you might ASK for an exception on string-to-number
conversion on things that don't look like strings (as -w gives you in
Perl 5), but I'm not seeing anything in the Apocalypses that says so.
Perhaps if you'd said something like:

        sub logError($msg, Int +$prio is strict::Number = 4, *%errInfo) {...}

or something of that sort, I could buy it, but a) there's no way to make
this a compile-time error that I know of and b) why would you want to?
Do you want to say that:

        logError($msg, prio=>CGI.param("priority"))

is an error at compile time because CGI.param is defined as returning a
Str, even though it might well be a numeric value in that string?

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to