develooper Front page | perl.perl5.porters | Postings from May 2015

Re: ex-nextstate on commented line

Thread Previous | Thread Next
From:
Paul Johnson
Date:
May 8, 2015 23:52
Subject:
Re: ex-nextstate on commented line
Message ID:
20150508235225.GF9723@pjcj.net
On Thu, Apr 16, 2015 at 04:16:57PM -0400, Matthew Horsfall (alh) wrote:
> On Thu, Apr 16, 2015 at 11:09 AM, Paul Johnson <paul@pjcj.net> wrote:
> > I have tracked down the cause of some Devel::Cover failures with
> > bleadperl:
> >
> > $ perl5.20.2 -MO=Concise -e '#x'
> > -e syntax OK
> > $ perl5.21.6 -MO=Concise -e '#x'
> > -e syntax OK
> > $ perl5.21.7 -MO=Concise -e '#x'
> > 3  <@> leave[1 ref] vKP/REFC ->(end)
> > 1     <0> enter ->2
> > 2     <0> stub v ->3
> > -     <;> ex-nextstate(main 1 -e:1) v:{ ->3
> > -e syntax OK
> > $ perl5.21.11 -MO=Concise -e '#x'
> > 3  <@> leave[1 ref] vKP/REFC ->(end)
> > 1     <0> enter ->2
> > 2     <0> stub v ->3
> > -     <;> ex-nextstate(main 1 -e:1) v:{ ->3
> > -e syntax OK
> >
> > Thoughts?
> 
> Bisect says it came in here:
> 
>   34b54951568575920f2307bea918f5549bd5a82f is the first bad commit
>   commit 34b54951568575920f2307bea918f5549bd5a82f
>   Author: Father Chrysostomos <sprout@cpan.org>
>   Date:   Thu Nov 20 09:23:35 2014 -0800
> 
>     [perl #77452] Deparse { ...; BEGIN{} } correctly
> 
>     8635e3c2 (5.21.6) changed the COP sequence numbers for nested blocks,
>     such that most BEGIN blocks (incl. ‘use’ statements) and sub declara-
>     tions end up in the right place.  However, it had the side effect of
>     causing declarations at the end of the enclosing scope to fall out of
>     it and appear below.
> 
>     This commit fixes that by adding an extra nulled COP to the end of the
>     enclosing scope if that scope ends with a sub, so the final declara-
>     tion gets deparsed before it.
> 
>     The frequency of sub declarations at the end of the enclosing scope is
>     sufficiently low (I’m guessing a bit here) that this slight increase
>     in run-time memory usage is probably acceptable.
> 
>     I had to change B::Deparse to deparse nulled COPs the same way it does
>     live COPs, which means we get more extraneous semicolons than before.
>     I hope to fix that in a forthcoming commit.  I also ran into a B bug,
>     in that null ops are not presented to Perl code with the right op
>     class (see the blessing in the patch).  I plan to fix that in a separ-
>     ate commit, too.

Father C doesn't seem to be around at the moment, so I wonder whether
anyone else has any ideas on whether or not this change is acceptable?

As far as I can tell it doesn't introduce any user visible changes, if
we think of B::Deparse as user visible and B::Concise as not.  But it
appears that we now have a workaround for a workaround.  And if we keep
this I am going to need to put another layer of workaround into
Devel::Cover.  I'll do that if necessary, but I'd be very happy if it
were not necessary.

So please provide your informed opinion in the space below which, unlike
Fermat's margin, will grow to accommodate your musings.

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net

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