[R6RS] open-file-input+output-port

dyb at cs.indiana.edu dyb at cs.indiana.edu
Tue Aug 22 07:46:20 EDT 2006


I would like to propose the following changes to support bidirectional
ports:

 * replace open-file-input+output-ports, which returns two ports, with
   open-file-input+output-port (no final 's'), which returns one
   bidirectional port

 * replace input-port-position and output-port-position with
   port-position

 * replace set-input-port-position! and set-output-port-position! with
   set-port-position!

 * relegate close-input-port and close-output-port to the R5RS library
   and add close-port

 * replace call-with-input-port and call-with-output-port with
   call-with-port

 * add port? which returns #t for any port

 * make input-port? return #t for both input ports and input-outout ports

 * make output-port? return #t for both output ports and input-outout ports

Rationale:

 * open-file-input+output-port provides access to bidirectional port
   functionality that is available in current operating systems.

 * there's no question about whether closing one port closes the other,
   since there is only one port

 * there's no question about whether reading and writing are synchronized,
   since there is only one port

Some of my earlier questions wrt opening two separate ports, one for for
writing and one for reading, and wrt locking files, are probably
non-issues.  I can't find any guarantee for Unix or Windows that a read on
one file descriptor that follows a write on another are performed in
order, so I am still concerned about race conditions with separate ports.

I don't know what to do about transcoders.  It seems with either the
original or proposed set of procedures, two transcoders need to be
provided, one for input and one for output.  But I still don't fully
understand transcoders.

Kent



More information about the R6RS mailing list