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

Re: [perl #123738] eval {} still clobbers $@ in a DESTROY

Thread Previous
From:
Aristotle Pagaltzis
Date:
February 6, 2015 10:16
Subject:
Re: [perl #123738] eval {} still clobbers $@ in a DESTROY
Message ID:
20150206101646.GB75915@plasmasturm.org
* Aristotle Pagaltzis <pagaltzis@gmx.de> [2015-02-06 11:00]:
> So I would guess the bug is due to `foreach` aliasing – specifically
> that the per-iteration aliasing is normally undone at the end of the
> iteration but that that is preempted by the `die` here, such that the
> unaliasing winds up delayed until all the way after the statement. So
> the `warn` *inside* that statement picks up the right exception (and
> would do so even without the anti-clobber fix if my guess is right),
> but then the unaliasing catches up so that by the *next* statement the
> exception is gone.

OTOH – a `warn $_` during the same statement doesn’t see the Destroyer
instance, so the loop iterator variable is already unaliased at that
point, meaning it can’t be the unaliasing as such. But my guess is that
it still has to have to do with some aspect of how aliasing works (such
as how it interacts with the refcount, or whatever – I don’t know enough
perlguts to take a shot), since the bug is not dependent on extra scopes
(statement modifier `for` will do just fine) but does require `for` (any
regularly assigned variable will not exhibit this behaviour).

-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous


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