develooper Front page | perl.perl5.porters | Postings from June 2021

Re: parse_block() and unbalanced scope stack

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
June 21, 2021 20:30
Subject:
Re: parse_block() and unbalanced scope stack
Message ID:
20210621213037.7c0430bb@shy.leonerd.org.uk
On Mon, 21 Jun 2021 20:07:43 +0000
"mah.kitteh via perl5-porters" <perl5-porters@perl.org> wrote:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Monday, June 21st, 2021 at 2:56 PM, Paul "LeoNerd" Evans
> <leonerd@leonerd.org.uk> wrote:
> 
> > On Mon, 21 Jun 2021 17:07:46 +0100
> >
> > "Paul \"LeoNerd\" Evans" leonerd@leonerd.org.uk wrote:
> >  
> > > It turns out I can fix this by the horrible hack of:
> > >
> > >     /* REALLY??! Do I really have to do this?? */
> > >     while(PL_scopestack_ix > was_scopestack_ix)
> > >       LEAVE;  
> 
> For my own edification, why is this not an "if" - or is this a busy
> wait or something? Seems to imply a race condition (and that doesn't
> make any sense to my current understanding of the sequential nature
> of the runtime) - but I also admittedly don't know what I am looking
> at.

Each LEAVE call will reduce the scopestack height by 1. So if it's out
of sync by more than a difference of 1, we'll have to call it twice, or
three times, etc until it's level again.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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