[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] valid implementation of call-with-input-file?
On Mon 20 Aug 2012 05:22, Alex Shinn <alexshinn@x> writes:
> It's expected that implementations close files on
> gc, and a good implementation should gc when out
> of file descriptors as well. An alternate approach
> to more timely releasing of resources would be
> to add stronger guarantees about when gc occurs -
> again, an area of open research not yet ready for
Leaving file closing to GC is the wrong thing to design for. It's an OK
fallback but it's not a good base case.
Part of the reason is that files are closed during finalization, which
does not have to run when GC runs. The Java world, for example, has
standardized on running finalizers in a separate thread. Guile does
this as well, when possible. So running GC might not have the effect of
There are a number of Scheme systems out there that support what Peter
and I want to do. Guile's `with-throw-handler' is one example. I'm
sure Chicken has something as well.
Scheme-reports mailing list