Each port has an associated buffer mode. For an output port, the
buffer mode defines when an output operation flushes the buffer
associated with the output port. For an input port, the buffer mode
defines how much data will be read to satisfy read operations. The
possible buffer modes are the symbols
none for no buffering,
line for flushing upon line endings and reading up to line
endings, or other implementation-dependent behavior,
block for arbitrary buffering. This section uses
the parameter name buffer-mode for arguments that must be
If two ports are connected to the same mutable source, both ports are unbuffered, and reading a byte or character from that shared source via one of the two ports would change the bytes or characters seen via the other port, a lookahead operation on one port will render the peeked byte or character inaccessible via the other port, while a subsequent read operation on the peeked port will see the peeked byte or character even though the port is otherwise unbuffered.
In other words, the semantics of buffering is defined in terms of side effects on shared mutable sources, and a lookahead operation has the same side effect on the shared source as a read operation.
buffer-mode-symbol must be a symbol whose name is one of
block. The result is the
corresponding symbol, and specifies the associated buffer mode.
Note: Only the name of buffer-mode-symbol is significant.
#t if the argument is a valid buffer-mode symbol, and