[R6RS] Slightly less trivial I/O question

Michael Sperber sperber
Thu Mar 3 11:37:02 EST 2005


> The file is opened for input or output, an input or output port
> connected to it is made the default value returned by
> current-input-port or current-output-port (and is used by (read),
> (write obj), and so forth), and the thunk is called with no
> arguments. When the thunk returns, the port is closed and the
> previous default is restored.

Now, this usually means the CURRENT-INPUT-PORT / CURRENT-OUTPUT-PORT
will return a different value in the extent of one of these.

The I/O system I'm working on allows (just like Reppy's library)
redirecting a port to another source / destination.  It'd therefore be
more natural in that setting if there was only ever one current input
port, and one current output port, and WITH-INPUT-FROM-FILE and
WITH-OUTPUT-TO-FILE would simply temporarily redirect that port.  I'm
thinking the above wording even allows this, except for the "the port
is closed" bit.

Would anyone mind if all redirection would happen through the
redirection mechanism inherent in the ports, rather than through
changing the return value of CURRENT-INPUT-PORT and
CURRENT-OUTPUT-PORT?  I doubt that any R5RS programs would break, if
though it may be possible to write an artificial program that could
detect the change.

Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla

More information about the R6RS mailing list