Re: [Scheme-reports] valid implementation of call-with-input-file?
Andy Wingo 21 Aug 2012 19:09 UTC
Hi,
On Tue 21 Aug 2012 04:36, Alex Shinn <alexshinn@gmail.com> writes:
>> 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.
I believe I responded to this adequately in my reply to Alaric. I think
this is fine and great & stuff. Non-local exits that do not use the
exception mechanism would still keep the file open, and that's super.
> 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.
Exceptions are a conventional form of nonlocal exit. You can of course
use other non-conventional means like amb or general call/cc. But the
expectation should be that if you throw an exception, associated cleanup
handlers get run, from the dynamic extent of the throw on out to the
catch.
> `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.
This is ridiculous. The same argument would support not closing the
file after a normal exit from the c-w-i-f procedure.
Andy
--
http://wingolog.org/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports