[plt-scheme] Noticeable absence of (with-output-to-port ...)and(with-input-from-port ...)

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Sep 11 16:01:26 EDT 2008

Call-with-output-file creates a port and it's locical that it closes that 
Call-with-output-port does not create a port, and therefore it should not 
close it.
Nevertheless you can always wrap things in a dynamic wind that makes sure 
the port is closed whenever control leaves the thunk (and may be reopens the 
port when control comes back into the thunk. Or you may want a continuation 
barrier around the thunk to make sure it can not be reentered by 
continuations that are captured by the thunk. Things depend on what you want 
(the reason why not all programs have been written yet)
----- Original Message ----- 
From: "Noel Welsh" <noelwelsh at gmail.com>
To: "Jos Koot" <jos.koot at telefonica.net>
Cc: "PLT Scheme List" <plt-scheme at list.cs.brown.edu>
Sent: Thursday, September 11, 2008 8:08 PM
Subject: Re: [plt-scheme] Noticeable absence of (with-output-to-port 
...)and(with-input-from-port ...)

> Wouldn't you want to close the port afterwards?  This, to me, is the
> main advantage of with-output-to-file
> N.
> On Thu, Sep 11, 2008 at 7:00 PM, Jos Koot <jos.koot at telefonica.net> wrote:
>> Well a procedure is to be preferred, I think:
>> (define (with-output-to-port port thunk)
>> (parameterize etc)
>> Jos

Posted on the users mailing list.