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

Re: [perl #20683] [fix] /(??{$x})/ ignore any changes made to $x

Thread Previous | Thread Next
From:
hv
Date:
February 25, 2003 18:58
Subject:
Re: [perl #20683] [fix] /(??{$x})/ ignore any changes made to $x
Message ID:
200302260300.h1Q30n616411@crypt.compulink.co.uk
Enache Adrian <enache@rdslink.ro> wrote:
:On Mon, Feb 24, 2003 at 02:06:38AM +0000, hv@crypt.org wrote:
:> Precompiling the returned patterns bypasses the (obviously buggy)
:> optimisation altogether. I think it might make most sense to remove
:> the optimisation and document this as the recommended approach.
:
:The optimization seems to be valuable even in simple, un-branched
:cases, so why not keep it in ?

Well, the more types of magic we apply unasked to random SVs, the
more possible interactions between different types of magic we have
to cope with, and the more bugs we introduce. This is one type of
magic that has already been shown to be buggy, and is not of any
great benefit since the only change in behaviour it provides is an
optimisation that you can easily supply for yourself by writing your
(??{...}) constructs slightly different (and those constructs are
pretty rare in any case).

That was my original thinking. But looking over the patch again,
I notice that it now tries hard to avoid interaction with other
magic, which should help to reduce the potential for bugs, so I've
applied it.

:Of course, it's always better to precompile its regexp's and to
:avoid (??{ .. }) altogether.

Not precompiling regexps is a quite distinct thing from using
(??{...}) - the latter is a very useful construct on those rare
occasions you need it. I would rather like to elevate it out
of the "experimental" pit for the next release, though it'll
need a number of problems fixing before that is possible.

Hugo

Thread Previous | Thread Next


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