Bart Lateur writes:
: Apropos those extended mechanisms: couldn't we use the same mechanism as
: is currently in use for $!, for $@ too? I mean: $! in numerical context
: gives an error number, in string context a text string. Then
: 
:       die "I'm outta here: $!";
: 
: should assign both the numeric representation of $! and the new text
: representation, the custom text, to the current $@ (future $!).

Whatever you do with the string or numeric part, I think the new $! should
push the old $! onto its stack of the old exception objects.

: That numerical part could then form the basis of the extended exception
: mechanism. No, the programmer shouldn't memorize the error numbers:
: there should be predefined constants, like
: 
:       ERROR::filenotfound
: 
: which are numeric, and which could then be used for the catch switch.
: Well, maybe drop the "ERROR::" part for brevity -- but not for clarity.

I think I agree with the folks that say errors should be caught by
type, not by number.  Just as a for instance, you ought to able to
write a simple handler that catches any ERRNO-style error.

Larry

Reply via email to