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

[perl #24250] "return" required in some anonymous closures

From:
Father Chrysostomos via RT
Date:
April 20, 2012 06:27
Subject:
[perl #24250] "return" required in some anonymous closures
Message ID:
rt-3.6.HEAD-4610-1334928418-403.24250-15-0@perl.org
On Fri Apr 20 04:38:42 2012, nicholas wrote:
> What's curious is that I never remember anyone hitting this problem
> again. Perhaps it's not as common as we thought.

Don’t we ask people to check whether bugs have been reported already?  I
run into it from time to time.

> On Tue, Oct 21, 2003 at 09:34:24PM +0100, Dave Mitchell wrote:
> > In the medium-term, I want to remove the sub(){$x} feature from
> Perl,
> > and also make constant.pm do it another way. Both are relatively
> easy to
> > do (although in the longer term there may be even cleverer ways of
> doing
> > it in constant.pm that would be harder to do but more efficient).
> 
> constant.pm now takes advantage of the "proxy constant subroutines"
> on all versions from 5.10.0 onwards. It no longer users the fragile
> "feature" under discussion here, that
> 
>     *foo::bar = sub () { $baz; }
> 
> for an unshared $baz of value 42 behaves the same as
> 
>     sub foo::bar () {
>         42;
>     }
> 
> and creates a constant subroutine that the parser knows it can inline.
> 
> So I think we've done the first part of that - "another way"
> 
> > So the only real question for 5.8.2 is whether we want to add a
> > deprecation warning for the feature we added (undocumented) in 5.8.0
> > and which we intend to remove in 5.10.0 (conscensus permitting).
> 
> 
> So, do we want to remove the inlining of (inferred to be)-constant
> value
> closures?

Yes!

> And only inline subroutines that trivially return true
> constants.
> And fix this 5.8.0 regression. What is relying on the regressed
> behaviour?

Let’s put it in 5.17.early and find out!

-- 

Father Chrysostomos


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



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