[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] valid implementation of call-with-input-file?



On Mon, Aug 20, 2012 at 7:33 PM, Andy Wingo <wingo@x> wrote:
> Hi,
>
> Briefly, as I'd like to be to-the-point regarding WG1's work:
> call-with-input-file is not a good abstraction, because it can easily
> leaks FDs on exceptional exit, and is prevented from doing something
> more sensible.

It's not strictly a leak because the resources will
be reclaimed on finalization - you just don't have
strong guarantees about when that will happen.

> I want them both, but given a choice I would rather have a useful
> call-with-input-file (etc) than raise-continuable, in the small r7rs.

As Alaric points out, with call/cc people can still
write their own raise-continuable.

More generally, an exception does not mean control
won't return to the body.  For example, if amb is used
anywhere inside the dynamic extent of a c-w-i-f, then
the next amb-fail will return there, even if called inside
or after an external exception handler.

`exception-protect' is useful but is only an 80% solution.
It is therefore not appropriate for call-with-input/output-file.
We can provide `exception-protect' and possibly other
approaches in WG2, explore more options in the future,
and let users choose which is most appropriate for their
individual uses of c-w-i-f.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports