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

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



Andy Wingo <wingo@x> wrote:

> I think we should specify that exceptional exits close the port, as the
> above implementation does.

This isn't actually a good implementation. Exceptions do not constitute, 
and should not be equivalent to, non-local exits that can never return. 
Exceptions may be continuable, and in the case of a continuable exception, 
we may return and do some more work. In this case, closing the port 
is incorrect.

Even in the case where we have a non-continuable exception, it may be that 
we can try to restart the computation in certain cases, and we should not 
close the port in this case either. 

In other words, you cannot really guarantee that you won't want the port 
open in the general case, so you should not close it. It is easy enough 
to create a macro to encapsulate an use case that you want, if you know that 
you only use that style of programming, and all your exceptions will never 
continue the computation.

-- 
Aaron W. Hsu | arcfide@x | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.

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