develooper Front page | perl.perl5.porters | Postings from October 1999

Re: deprecating SIGDIE

Thread Previous | Thread Next
From:
Joshua N Pritikin
Date:
October 1, 1999 05:54
Subject:
Re: deprecating SIGDIE
Message ID:
19991001085416.V14723@eq1062.wks.na.deuba.com
On Fri, Oct 01, 1999 at 01:40:46PM +0100, nik@tiuk.ti.com wrote:
> Joshua N Pritikin <joshua.pritikin@db.com> writes:
> >Isn't it that true that $SIG{__EXCEPTION__} will not be able to *change*
> >the exception string/object, only record it?
> 
> That is true of __DIE__ these days too - but it can re-throw an  
> alternative

That's what I mean.  This re-throwing cannot be allowed to interfere
with proper exception handling.

> $SIG{__EXCEPTION__} = sub { die "Gibberish" };
> eval { die "Sanity" };
> print $@;
>
> Which is in essence what all the local hackery is to protect against.

Yes, that must always print 'Sanity'. $SIG{__DIE__} is broken because it
permits re-throwing.  Let's deprecate it and add $SIG{__EXCEPTION__} in
it's place.  $SIG{__EXCEPTION__} will work exactly like $SIG{__DIE__}
except that re-throwing will not be permitted.

If an exception *does* happen in $SIG{__EXCEPTION__} then maybe it can
be routed through the warning mechanism?  Or we can exit(), but that
seems too severe.  On the other hand, the buck has to stop somewhere. 
We can't just keep adding $SIG{__EXCEPTION_DIED__}, etc.  We are
dangerously close to implementing an exception mechanism for the
exception mechanism.

-- 
"Does `competition' have an abstract purpose?"
       via, but not speaking for Deutsche Bank

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