How does this work? 1 my $fh = IO::File->new(...); # Compiler can know that the new object is still linked. 2 &some_sub ($fh); # Who knows? :-) # Compiler will assume that new object is still linked. 3 undef $fh; # Er? Need a DOD run right now, because that may have been the last link # to it, and my impression was that "deterministic" meant that, not # "at the end of the next block. I might be looping without ever leaving # the block 4 @main::some_global = (); # Need a DOD run right now, because how do I know if &some_sub stashed a # link to it in the global array?
I think that if we have unrefcounted "deterministic destruction" objects somewhere freely in the GC system, then we'll be needing a DOD run after every statement (or, actually after any assignment within every statement) if we want truly deterministic destruction. Although it's probably possible reasonable not to DOD if &some_sub uses %MY to mess around with its caller's lexicals (and undef $fh at line 2) It might be nice to offer "very deterministic" destruction (as above, as perl5), and laxer "at the end of a block" destruction. Plus, we could get the dangling zero external reference loops immediately (the ones perl5 misses) with a DOD run, or we could still do better than perl5 by only guaranteeing to find them at some specified time later ("at DOD runs" being one time we could specify) All ways of doing deterministic destruction seem to have considerable overhead. Nicholas Clark -- Even better than the real thing: http://nms-cgi.sourceforge.net/