I think the problem is that the need to always ultimately resort to read
and thereby move the position in the IO buffer every time you read from it is just way more complicated than simply representing it as a reinterpreted array. Clearly I need to look into this more thoroughly though, I may have rejected that solution too quickly when I first got into this.
I definitely tended to have it in my mind that read
actually deletes data from the buffer, but I suppose that is never true. I’m definitely too ignorant about this and need to benchmark a prototype that uses only IO
and no unsafe methods.