On Thu, Jun 23, 2016 at 05:52:44PM +0100, Zefram wrote: > 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. The first failure is due to the various scope-leaving ops (such as pp_leavetry) not freeing temps on scope exit in void context. They used not to in scalar and aray contexts too, but that that was one of the things I changed in 5.23.8. I ummed and ahhed about whether to do it for void context too, but couldn't think of a case where it would matter, so left it with the more efficient status quo. The second failure is because in addition, assigning to a ref doesn't immediately free the referent: instead it mortalises it. This is so that things like $a = $a->[0] work. This coupled with the non-freeing of mortals in void scope exit explains the second failure. -- The Enterprise's efficient long-range scanners detect a temporal vortex distortion in good time, allowing it to be safely avoided via a minor course correction. -- Things That Never Happen in "Star Trek" #21Thread Previous | Thread Next