develooper Front page | perl.perl6.internals | Postings from February 2001

Re: Garbage collection (was Re: JWZ on s/Java/Perl/)

Thread Previous | Thread Next
February 15, 2001 02:58
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
Tim Bunce wrote:
> On Thu, Feb 15, 2001 at 08:21:03AM -0300, Branden wrote:
> > And don't forget that if we stick with refcounting, we should try to
find a
> > way to break circular references, too.
> As a part of that the weak reference concept, bolted recently into perl5,
> could be made more central in perl6.
> Around 92.769% of the time circular references are known to be circular
> by the code that creates them (like a 'handy' ref back to a parent node).
> Having a weakref, or similar, operator in the language would help greatly.

Do weakrefs really work on Perl 5? I know they're not incremented when they
are created, but aren't they decremented (and try to free the object) when
they go out of scope? What happens if the object goes out of scope before
the variable with the weakref does?

Weakrefs are probably useful to break circular references in 99% of the
cases. But we must make sure they work properly! And also that bugs while
using them don't dump core, at most throw exceptions.

- Branden

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About