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 "constant.pm" ? 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