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

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



On Wed, Aug 22, 2012 at 4:09 AM, Andy Wingo <wingo@x> wrote:
> Hi,
>
> On Tue 21 Aug 2012 04:36, Alex Shinn <alexshinn@x> 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.

You acknowledged that whether we put it in the
small language or not, people will have raise-continuable.
This is incompatible with your definition of c-w-i-f.

No one is talking about non-local exits that do not use
the exception mechanism.

>> 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.

No it would not, because that's the existing c-w-i-f semantics
(that the port is closed after the first normal return).

You are proposing a change to the semantics which could
break existing R6RS programs, and existing R5RS programs
that use an exception system.

-- 
Alex

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