useless destructors

Roy Smith roy at panix.com
Tue Jun 22 07:48:28 EDT 2004


In article <pan.2004.06.22.09.56.49.888803 at knm.org.pl>,
 Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:

> On Tue, 22 Jun 2004 02:36:24 -0700, David Turner wrote:
> 
> > Further to the discussion from earlier titled "does python have
> > useless destructors?", I've posted a brief summary of garbage
> > collection, RAII, and the "using" clause (which is what PEP310's
> > "with" clause amounts to).  The post is here:
> > 
> > http://dkturner.blogspot.com/2004/06/garbage-collection-raii-and-using.html
> 
> You left "for later" a point which makes the last proposition unworkable:
> how to implement selective refcounting in a dynamically typed language?
> Will it still work if the refcounted object is referred to from a plain
> object? The only way I can imagine is to manage refcounts on each object
> passing, returning and rebinding.

Well, you could take a page from perl, and "taint" refcounted objects.  
Any time you make a reference to an object, if the referenced object is 
refcounted, the referrer becomes refcounted too.

The next question is, would this in practice end up refcounting most 
objects?  If so, that would sort of defeat the purpose.



More information about the Python-list mailing list