Hello schemers,
I noticed something in R7RS that I find puzzling.
The current input and output ports are textual ports, at least
initially:
| (current-input-port) procedure
| (current-output-port) procedure
| (current-error-port) procedure
| Returns the current default input port, output port, or error port (an
| output port), respectively. […] The initial bindings for these are
| implementation-defined textual ports.
And it is used by default in several of the input procedures:
| 6.13.2. Input
| If port is omitted from any input procedure, it defaults to the value
| returned by (current-input-port). […]
However, this *textual* port is also used for the *binary* input
procedures:
| (read-u8) procedure
| (read-u8 port) procedure
| Returns the next byte available from the binary input port, updating
| the port to point to the following byte. If no more bytes are
| available, an end-of-file object is returned.
Note the (read-u8) entry, which will default to using
(current-input-port) according to the text in 6.13.2.
The entries for (peek-u8), (u8-ready?), (read-bytevector k) and
(read-bytevector! bytevector) are similar.
On the output side there are (write-u8 byte) and (write-bytevector
bytevector), which similarly use (current-output-port).
Is there some specified behavior I'm missing? It seems to me that
(read-u8) etc are straight up errors.
--
Göran Weinholt |
https://weinholt.se/
Debian Developer | 73 de SA6CJK