I was thinking again about design for suspended in...
# io
I was thinking again about design for suspended input (it seems that suspended ouptut does not make any sense since it fire-and-forget anyway). Duplicating all functionality like
in a suspended manner seems to be troublesome and does not really help since we would not be able to reuse
methods for supposed
. It seems that is better to have some kind of
class which has single method with signature
suspend fun awaitBytes(size: Int, block: Input.()->R):R
. The idea is that we suspend caller untill
of bytes is fetched or at least guaranteed to be fetched in non-blocking manner. After that we can work with those bytes with regular
-based way. Working with packages of unknown size could be a bit cumbersome, but I do not thing there are lot of cases, where we really need it.