At 09:41 PM 8/28/00 -0600, Tony Olekshy wrote:
>I just want the cognitive simplicity of knowing that $@ and every
>@@ isa Exception, no matter what.
>
>Why not merge $!, $^E, and $@ into $!, but leave $@ alone too?
>That way, none of the existing die/eval code will break without
>being modified to check ref $!.

How about this: RFC 151 stands ($! is the only error variable), but it is 
*always* an object.  Whether it's in the Exception class or not I don't 
really care (although it isn't really an exception IMHO unless it was $@ 
from RFC 88), but some attribute of the object tels you whether it's 
something you can catch or die from.  It always stringifies to the last 
error.  In a numerical context it is errno if it was a $!-type thing, or 
the return code if it was a $?-type thing.  In the latter case the string 
context would have to be the numerical code again, there is no textual 
interpretation.

Now, every error is guaranteed to be an object.  You can call some method 
or check some attribute of it to find out if it was an exception.  If 
you're checking a system() or `` failure, you use it in numerical 
context.  If you're checking a builtin failure, you use it in string 
context (unless you have some fetish about errno).

I don't know about you, but this sounds pretty good to me.
--
Peter Scott
Pacific Systems Design Technologies

Reply via email to