Front page | perl.perl5.porters |
Postings from April 2013
DAVEM TPF bug-grant report #163
From:
Dave Mitchell
Date:
April 23, 2013 11:30
Subject:
DAVEM TPF bug-grant report #163
Message ID:
20130423113046.GA2216@iabyn.com
This week I worked on handling arrays embedded within literal regexes,
e.g. /...@a.../. This was partially to fix a regression from 5.16.x
where, if @a contained a qr/...(?{...}).../, then suddenly you'd need
a 'use re eval' where you didn't need one before: RT #115004.
But it also enhances the behaviour of array interpolation relative to
5.16.x too, especially relating to closures and overloading.
Basically, the traditional behaviour of run-time patterns such as
/a${b}c/ was to concatenate the pattern components together, then pass it
to the regex engine. My 5.17.1 jumbo re_eval fix basically changed that so
that the list of args was preserved and passed as-is to the regex engine.
This meant that the engine could do things like extract out existing
optrees from code blocks in something like $b = qr/...(?{...}).../, rather
than having to recompile them. So closures work properly.
The thing I missed back then was applying the same new handling to arrays
as well as scalars. Until my commits last week, /a@{b}c/ would be parsed as
regcomp('a', join($", @b), 'c')
This means that the array was flattened and its contents stringified before
hitting the regex engine.
I've now changed it so that it is parsed as
regcomp('a', @b, 'c')
(but where the array isn't flattened, but rather just the AV itself is
pushed onto the stack, c.f. push @b, ....).
As well as handling closures properly, it also means that 'qr' overloading
is now handled with interpolated arrays as well as with scalars:
use overload 'qr' => sub { return qr/a/ };
my $o = bless [];
my @a = ($o);
"a" =~ /^$o$/; # always worked
"a" =~ /^@a$/; # now works too
As well as the new handling of arrays, the pattern concatenation code
within Perl_re_op_compile was heavily reworked, resulting in fixing a
utf8 edge case, and generally simplifying the code, including enabling
the removal of a clunky if (0) { label: ... } bit of code.
Unfortunately this branch just missed the cut for 5.17.11.
Report for period 2013/04/15 to 2013/04/21 inclusive
SUMMARY
-------
Effort (HH::MM):
0:47 diagnosing bugs
14:33 fixing bugs
0:00 reviewing other people's bug fixes
0:00 reviewing ticket histories
0:00 review the ticket queue (triage)
-----
15:20 TOTAL
Numbers of tickets closed:
1 tickets closed that have been worked on
0 tickets closed related to bugs that have been fixed
0 tickets closed that were reviewed but not worked on (triage)
-----
1 TOTAL
DETAIL
------
[perl #113928] caller behaving unexpectedly in re-evals
2013/04/19 0:47 diag
[perl #115004] perl 5.17.x can't use @var in regexp, but only $var
2013/04/15 3:48 fix
2013/04/16 4:32 fix
2013/04/17 2:10 fix
2013/04/18 2:47 fix
2013/04/19 1:16 fix
2013/04/20 - close
--
More than any other time in history, mankind faces a crossroads. One path
leads to despair and utter hopelessness. The other, to total extinction.
Let us pray we have the wisdom to choose correctly.
-- Woody Allen
-
DAVEM TPF bug-grant report #163
by Dave Mitchell