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

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

Thread Previous | Thread Next
Peter Scott
February 13, 2001 10:30
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
At 01:16 PM 2/13/01 -0500, James Mastros wrote:
>On Tue, Feb 13, 2001 at 01:09:11PM -0500, John Porter wrote:
>Certainly AUTOLOAD gets
> > called if DESTROY is called but not defined ... just
> > like any other method.
>The idea is [for Larry] to declare "no, it isn't".  Otherwise, you have to
>do refcounting (or somthing like it) for DESTROY to get called at the right
>time if the class (or any superclass) has an AUTOLOAD, which is expensive.
>Perhaps you could declare, but not define, DESTROY to have AUTOLOAD called
>for DESTROY, and have DESTROY called as soon as the last ref goes out of
>scope.  (IE have a sub DESTROY; line.)

This may be a naive question, but what is the benefit - aside from 
consistency, and we don't need to rehash the litany on that - to AUTOLOAD 
getting called for DESTROY?  I've never actually seen any code that makes 
use of it.  I have grown somewhat tired of writing, and teaching, "return 
if $AUTOLOAD =~ /:DESTROY$/", however.
Peter Scott
Pacific Systems Design Technologies

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