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

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

Thread Previous | Thread Next
James Mastros
February 14, 2001 06:49
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
On Wed, Feb 14, 2001 at 10:12:36AM -0300, Branden wrote:
> David Mitchell wrote:
> > ... the above seems to imply a discussion that you only need to do
> expensive
> > ref-counting (or whatever) on objects which have a DESTROY method.
> > However, since you dont know in advance what class(es), if any, a thinngy
> > will be blessed as, you always have to ref-count (or whatever technique is
Blast.  You are absolutly right, Dave.

[snip about DESTORY predictablity not being neccessary]
You're probably right about that, Branden.  Quite nice, but not neccessary.

> Also, I think it would be valid for the programmer to explicitly say ``I
> would like to DESTROY this object now'', 
I'd think that an extension to delete is in order here.  Basicly, delete
should DESTROY the arg, change it's value to undef, and trigger a GC that
will get rid of the arg.

If the arg is a ref, it is /not/ derefed, so you'd oft want to use delete

> being used by others. The way I suggest to deal with this is set a flag if
> the object was already DESTROYed. Then if any other tries to use it, it
> raises an exception (dies) with a message about ``This object was already
> DESTROYed.''. 
I think an ordinary "attempt to dereference undef" will work.

  -=- James Mastros
"All I really want is somebody to curl up with and pretend the world is a
safe place."
AIM: theorbtwo 	     homepage:

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