develooper Front page | perl.perl5.porters | Postings from March 2017

Re: [perl #32714] Objects destroyed in the wrong order during globaldestruction

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 13, 2017 09:30
Subject:
Re: [perl #32714] Objects destroyed in the wrong order during globaldestruction
Message ID:
20170313093042.GF3641@iabyn.com
On Fri, Mar 10, 2017 at 07:38:02AM -0800, Nick Wellnhofer via RT wrote:
> Right, but it would solve a large class of cases.

But has just been pointed out, freeing package vars before calling
destructors breaks everything.

> Also note that Perl seems to do the right thing for "my" variables with
> package scope. Only for "our" variables, it seems impossible to get a
> sane destruction order.

file-scoped lexical variables are freed (or rather their reference count
is decreased) when execution falls off the end of the file or eval or
whatever. This is a well-defined point *before* global destruction.
They are also closed over by subs such as destructors, so will continue to
live if they are needed.

Package variables have no such concepts (well, subs tend to have ops that
hold a reference count to the gobs that hold the package vars, so in that
sense they close over package vars).


-- 
Standards (n). Battle insignia or tribal totems.

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