develooper Front page | perl.perl6.language | Postings from August 2001

Re: finalization

Thread Previous | Thread Next
From:
Jan Dubois
Date:
August 28, 2001 20:53
Subject:
Re: finalization
Message ID:
i7pootk7idpirru5ukclrb9ta980v68tb2@4ax.com
On Tue, 28 Aug 2001 18:35:34 -0700, Damien Neil <neild@misago.org> wrote:

>On Tue, Aug 28, 2001 at 09:07:03PM -0400, Sam Tregar wrote:
>> Well, there's the Perl 5 reference counting solution.  In normal cases
>> DESTROY is called as soon as it can be.  Of course we're all anxious to
>> get into the leaky GC boat with Java and C# because we've heard it's
>> faster.  I wonder how fast it is when it's halfway under water and out of
>> file descriptors.
>
>Speaking purely for myself, I'd rather have a non-refcounting GC
>because I'm rather tired of going through elaborate tricks to avoid
>ever creating circular data structures.

Have you actually tried working in a purely mark-and-sweep style GC
environment (Java/.NET)?  You don't have deterministic destruction order,
which means that effectively you don't have DESTROY *at all*.  Don't even
think about using finalizers; they are almost completely useless.
Everything that needs any kind of cleanup must be managed manually.  I
find that extremely painful and prefer refcounting any day.  Maybe I'm
just lazy.

Avoiding circular references is not that hard if you never store
references into package variables.  Just remember to break the circle
manually before you loose the last reference to it. :)

-Jan

Thread Previous | Thread Next


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