develooper Front page | perl.perl5.porters | Postings from December 2004

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

From:
Elizabeth Mattijsen
Date:
December 2, 2004 13:03
Subject:
Re: [perl #32714] Objects destroyed in the wrong order during global destruction
Message ID:
f06110422bdd5332000cf@[192.168.56.3]
At 1:21 PM -0500 12/2/04, Mark Jason Dominus wrote:
>  > Only in normal destruction. It _cant_ make the guarantee that you say it
>>  does or circular structures would never be broken during global destruction:
>
>Yes, you're right.  But in this case there is no circular structure.
>
>As I mentioned to Christoph Haas, our surprise at this situation might
>be the result of our misunderstanding of global destruction semantics.
>I am still willing to admit that, but it also seems to me that the
>present behavior is unnecessarily bad.
>
>>  That's why I was suggesting the counter approach. At least then you could
>>  know that the objects would be destroyed in a defined order.
>
>I misunderstood your suggestion.  Thanks for explaining it.
>
>It still seems to me that Perl's final destruction should have a first
>pass in which objects are destroyed normally, in
>reference-count-order, followed by a second pass to take care of any
>remaining circularly-referenced objects.  Or alternatively, that the
>outer object in my example should be destroyed at the end of program
>execution, but before the global destruction paqhse is initiated.

I think it would be possible to create a module (pragma) that would 
ensure an orderly (as in lifo) destruction of objects.  The only 
thing I miss is a way to make sure a specific END code block is 
executed as the very last END block.  Is there a way to do this? 
Possibly in XS?


Liz



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