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

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

Thread Previous
Dave Mitchell
October 21, 2003 13:27
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
On Tue, Oct 21, 2003 at 09:17:59PM +0100, Orton, Yves wrote:
> > The way I understand it now, is that the check for making this 
> > special case is somehow wrong.  How difficult would it be to add a 
> > check there that it would do the optimization if the current package 
> > is "" ?  And just not do the optimization otherwise?
> Lots of modules build their own constants using this technique to avoid the
> load time overhead associated with use constant. Carp::Assert comes to mind.

We're not here talking about named subs with constant values such as

    sub REAL_DEBUG  ()  { 1 }

but anonymous subs containing a single outer lexical that under some
circumstances is interpreted by Perl as a const sub factory (each time you
call it you get a new const sub).

Carp::Assert only appears to use the former, and there's no talk of that
feature going way.
Never do today what you can put off till tomorrow.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About