develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Why $@ makes me cry (was Re: Generic system() replacements)

Thread Previous | Thread Next
From:
Mark Mielke
Date:
June 25, 2008 06:04
Subject:
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
48624250.7060409@mark.mielke.cc
Aristotle Pagaltzis wrote:
> * Mark Mielke <mark@mark.mielke.cc> [2008-06-24 23:40]:
>   
>> What about some compromise whereby $@ is saved before, and
>> only restored if DESTROY completes successfully without an
>> exception?
>>     
>
> Some compromise… it would break *everyone*’s code:
>
>     eval {
>         # ...
>     };
>     if ($@) {
>         # now you might get here even though
>         # the `eval` block ran successfully
>         # ...
>     }
>   

I don't think you understood my proposal. Why would the above break? In 
the case of success in DESTROY, $@ is as expected. In the case of a die 
escaping DESTROY, $@ will be that die() which is the same as today.

Please explain the problem.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>


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