[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scheme-reports] valid implementation of call-with-input-file?
- To: scheme-reports <scheme-reports@x>
- Subject: [Scheme-reports] valid implementation of call-with-input-file?
- From: Andy Wingo <wingo@x>
- Date: Sun, 19 Aug 2012 11:23:03 +0200
Is this implementation of call-with-input-file valid?
(define (call-with-input-file filename proc)
(let ((port (open-input-file filename)))
(call-with-values (lambda () (proc port))
(apply values vals)))))))
I think no, due to the language on p52 of the report:
If proc does not return, then the
port must not be closed automatically unless it is possible
to prove that the port will never again be used for a read
or write operation.
I think we should specify that exceptional exits close the port, as the
above implementation does.
Scheme-reports mailing list