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

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

James Mastros
February 13, 2001 10:17
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
On Tue, Feb 13, 2001 at 01:09:11PM -0500, John Porter wrote:
> > James Mastros wrote:
> > >"It isn't possible to AUTOLOAD DESTROY." --perlmem(6)
[Note: that's a hypothetical quote.]

> I'm not sure what that means.  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.)

	-=- James Mastros
"All I really want is somebody to curl up with and pretend the world is a
safe place."
AIM: theorbtwo 	     homepage: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About