On Thu, Mar 9, 2017 at 9:55 PM, Nick Wellnhofer via RT < perlbug-followup@perl.org> wrote: > On Thu, 07 Jul 2016 09:49:52 -0700, dcollinsn@gmail.com wrote: > > Based on the above suggestions to make a pragma and upload it to cpan, > > and the report that Liz has done so, I believe this ticket can be > > closed? I intend to close resolved in a week unless there is some > > objection. > > I object to closing this bug. Perl really should run global destruction in > two phases: > > 1. Decrease the refcount of globals like "our" variables which will run > destructors in correct order unless there are circular references or > refcount leaks. > > 2. Only then forcibly destroy the remaining objects. > > Ideally, it should be possible to tell which of the two phases is run. > Some code may want to skip forced destruction in phase 2. > > There's no need for a pragma that adds additional overhead. Besides, "use > ogd" doesn't seem to be very useful. In most cases you don't want LIFO > order, but make sure that an object that is still referred to isn't > destroyed before the referrer. > Destructors can and do depend on package variables, this would not solve all non-circular cases. Just because the roots of the graph are package variables doesn't mean all package variables are roots. The proper solution would be to topologically sort the objects and then destroy them in that order (ideally even taking into account that the destruction can add new nodes to the graph), but this is non-trivial to implement and to execute; and obviously would still not solve circular references. LeonThread Previous | Thread Next