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

Re: Confused by eval behavior

Thread Previous | Thread Next
From:
Zefram
Date:
June 23, 2016 16:52
Subject:
Re: Confused by eval behavior
Message ID:
20160623165244.GD1170@fysh.org
John Siracusa wrote:
>      Is this expected behavior or a bug?

There is something funny going on there; those cases are not working as
intended.  I suspect that destruction is managing to happen outside the
expected unwinding time, perhaps due to mortal refs.  Note that in test
case 2 the object ref is actually the return value of the eval block,
which might have some bearing, but empirically adding "my $z = $foo;"
or similar as an additional statement inside the eval block changes the
result, even though it's a similar last statement in the block and yields
the same value from the block.  So there's more to this.

-zefram

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