[racket] rexp-match and optional output port

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Apr 11 11:11:03 EDT 2013





On Apr 11, 2013, at 11:06 AM, Steve Byan <stevebyan at verizon.net> wrote:

> 
> On Apr 11, 2013, at 10:34 AM, Robby Findler <robby at eecs.northwestern.edu> wrote:
> 
>> You need to close the port I believe. 
> 
> Thanks, I assumed the close wasn't needed except to release the file descriptor; I didn't realize it is also needed to flush the output buffer. I just read section 12.1 "Ports" which says close is necessary "to release low-level resources associated with the port." I should have also read section 12.1.3 "Port Buffers and Positions" in the reference. Perhaps section 12.1 would be improved by adding a mention of buffer flushing to the description of close?
> 
> My previous experience with output ports used "call-with-output-file" which implicitly closes the port, so I have at least some excuse for my ignorance :-)


Since your program is using the port in a way that isn't delimited syntactically for a dynamic extent, your program is responsible for closing the ports (or flushing them somehow). -- Matthias




Posted on the users mailing list.