I have been following the whole GC/timely destruction thing for a while and have a few questions/observations.
Most of the ref counting systems provide for very simple ref counting containers and, essentially, provide timely destruction for the simple case where a variable is not placed into some more complicated container. It seems to me that if we are worried about the simple cases like
sub foo {
my $bar = open "bar.txt"; yada; yada; yada; }
why not just have the compiler detect that $bar was not placed in a more complicated container and generate the code to close $bar at end of scope.
This will provide timely destruction in the simple and common case. For more complex cases timely destruction will not be assured.
Is there some glaring logical problem that I am missing here?
Matt