develooper Front page | perl.perl5.porters | Postings from August 2012

[perl #44367] goto LABEL doesn't work from within $SIG{__DIE__}

Thread Previous
From:
Father Chrysostomos via RT
Date:
August 13, 2012 09:57
Subject:
[perl #44367] goto LABEL doesn't work from within $SIG{__DIE__}
Message ID:
rt-3.6.HEAD-11172-1344877029-894.44367-15-0@perl.org
On Mon Aug 13 02:03:27 2012, smueller@cpan.org wrote:
> On 07/03/2012 10:27 PM, Father Chrysostomos via RT wrote:
> > On Tue Jul 03 13:17:46 2012, doy wrote:
> >> So have we decided this is a wontfix then?
> >
> > I haven’t. :-)
> >
> > I still think it a wart from the point of view of the Perl language
> > (rather than the implementation) that goto works to exit subroutines and
> > evals, but not sort blocks, tie/overload methods, eval 'BEGIN
{...}', etc.
> >
> > I would still like to fix this.
> 
> I won't stop you, but *please* don't fix this at the cost of 
> performance. My gut feeling is that this is because of some obscure 
> optimization such as "sort blocks do multicall" that makes a very big 
> difference in practice.

The reason it cannot exit a sort block is that sort is a single op that
starts a new runloop each time it calls the block (as opposed to map and
s/// which consist of multiple ops and use the main runloop).

The only overhead would be an extra setjmp for each runloop, which I
think would be negligible enough not to be reliably measurable.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=44367

Thread Previous


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