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

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

From:
Nicholas Clark
Date:
April 20, 2012 04:51
Subject:
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
20120420115128.GV9069@plum.flirble.org
On Fri, Apr 20, 2012 at 12:43:50PM +0100, Zefram wrote:
> Nicholas Clark wrote:
> >So, do we want to remove the inlining of (inferred to be)-constant value
> >closures?
> 
> Inlining of *actual* constant-value subs should remain, but "sub () {
> $x }" should not be perceived as constant-value.  We should replace

To be clear, there's a specific subset of sub () { $x } which are perceived
as constant value. The bug (#24250) is that that perception code isn't 100%
accurate. I *think* Dave is saying that it can never be 100% accurate, but
I'm not sure.

Also, assuming that it could be made 100% accurate, as the inlining is
supposed to be an optimisation, is there any way it user code can spot
the difference between doing it and not doing it, other than introspecting
the optree, or benchmarking something?

> that mechanism by an explicit generator for constant-value subs of
> runtime-specified value (trivially implemented in XS).

What does this generator give us, that putting references-to-constants in
the symbol table doesn't already give us?

> I've been wondering where the inlining really ought to be implemented.
> With the call-checker mechanism, maybe the inlining of constant-value
> subs should be exposed as a non-standard call checker, rather than
> marring the standard code with an awkward special case.

Does this reduce complexity?

Nicholas Clark



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