develooper Front page | perl.perl6.language | Postings from August 2000

Re: RFC 151 (v1) Merge C<$!>, C<$^E>, and C<$@>

Thread Previous | Thread Next
From:
Larry Wall
Date:
August 26, 2000 09:45
Subject:
Re: RFC 151 (v1) Merge C<$!>, C<$^E>, and C<$@>
Message ID:
200008261639.JAA03517@kiev.wall.org
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About