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

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

Dan Sugalski
February 13, 2001 10:37
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
At 10:32 AM 2/13/2001 -0800, Peter Scott wrote:
>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.

I have no idea. It's legal, though, so unless it's declared illegal (which 
is fine with me) it needs to be supported.


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                      teddy bears get drunk Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About