write-bytevector, write & co.
Lassi Kortela 16 Aug 2020 10:24 UTC
From the draft:
"A Scheme implementation which supports string-notated bytevectors may
use this notation when the write-bytevector procedure is called, or when
any of the write family of procedures is called upon a bytevector or
upon another datum containing a bytevector."
R7RS `write-bytevector` writes the raw bytes to a byte port, so no
particular syntax will be used.
It's a good question whether `write` should stick to RnRS syntax or use
extensions from SRFIs. We had the same discussion with SRFI 169
(underscores in numbers) and decided that `write` shouldn't use the SRFI.
Someone had the clever idea of using the SRFI's syntax for `display`
(since it's well-known and deliberately specified that `display` output
is not always readable by `read`), but sticking to RnRS syntax for
`write` which is stricter.
A configurable Scheme printer akin to the one in Common Lisp would be
useful, but I don't think we have a SRFI about that yet. The recent
monadic formatting and combinator formatting SRFIs go in that direction.