Python vs Java garbage collection?

Bengt Richter bokr at oz.net
Tue Dec 24 03:30:39 EST 2002


On Mon, 23 Dec 2002 12:00:50 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <martin at v.loewis.de> wrote:
>Erik Max Francis wrote:
[...]
>> What I was saying is that you need to safeguard external critical
>> resource acquisition and release with something more stringent than
>> relying on finalization, and that is because the Python documentation
>> even says so.  That is all.
>
>I completely understand, and I think you are wrong. You don't need 
>further safeguards; the ones you have are sufficient, atleast for some 
>(the majority?) of the application.
>
What if you took the approach of trying to design a way of having
guarantees of immediate finalization platform-independently?

E.g., suppose you had a suite-introducer whose purpose it was to define
a local block of statements like try/finally but so that the compiler
would automatically generate code so that all bindings created within
the suite would be monitored and and immediately (i.e., maybe even
during expression evaluation, but at least at the end of a statement)
finalized when the equivalent of ref count going to zero happened. E.g.,
	autofinalize:
            s = file('foo').read()

Then maybe it could be a language level guarantee (for conforming
implementations) rather than a CPython guarantee.

Regards,
Bengt Richter



More information about the Python-list mailing list