call-with-port -- r7rs Definition procedure;
call-with-port (from vonuvoli);Procedure variants:
((port procedure-1) -> (any))
port;procedure-1;any;scheme:base -- (scheme base);scheme -- (scheme);(call-with-port port proc)Domain: It is an error if
procdoes not accept one argument.The
call-with-portprocedure callsprocwithportas an argument. Ifprocreturns, then the port is closed automatically and the values yielded by theprocare returned. Ifprocdoes 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.Rationale: Because Scheme's escape procedures have unlimited extent, it is possible to escape from the current continuation but later to resume it. If implementations were permitted to close the port on any escape from the current continuation, then it would be impossible to write portable code using both
call-with-current-continuationandcall-with-port.
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.
port;procedure-1;any;