Date: Mon, 22 Jun 2026 12:53:52 +0200
> Chunking input is a separate concern from correcting endianness, therefore
> they should be modeled separately (per the Single Responsibility Principle)
> which is exactly what P4030 does by modeling only endianness correction.
>
They are on some level separable; the problem is that there is a cost to
the separation, and it's unclear whether we want to encourage everyone
paying that cost by default (what is in the standard is automatically the
default in a sense).
You can technically compose std::fwrite from std::putchar, but that's not a
great motivation for only providing the latter. In fact, it's quite
reasonable not to provide the latter at all. In fact, the only way to write
to a file descriptor in the WASI is using an fd_write which takes an array
of pointers to contiguous buffers, so it can do even more work in one call
than std::fwrite.
In short, just because it may be academically satisfying to compose from
smaller utilities doesn't mean that it's good engineering. I'd rather only
have WASI fd_write() instead of only having putchar(), and I'd rather have
views::from_big_endian_bytes instead of views::from_big_endian.
> they should be modeled separately (per the Single Responsibility Principle)
> which is exactly what P4030 does by modeling only endianness correction.
>
They are on some level separable; the problem is that there is a cost to
the separation, and it's unclear whether we want to encourage everyone
paying that cost by default (what is in the standard is automatically the
default in a sense).
You can technically compose std::fwrite from std::putchar, but that's not a
great motivation for only providing the latter. In fact, it's quite
reasonable not to provide the latter at all. In fact, the only way to write
to a file descriptor in the WASI is using an fd_write which takes an array
of pointers to contiguous buffers, so it can do even more work in one call
than std::fwrite.
In short, just because it may be academically satisfying to compose from
smaller utilities doesn't mean that it's good engineering. I'd rather only
have WASI fd_write() instead of only having putchar(), and I'd rather have
views::from_big_endian_bytes instead of views::from_big_endian.
Received on 2026-06-22 10:54:06
