JasonB
07/18/2024, 8:19 PMuse
blocks: let's say I have a reader and a writer - if I nest the writer's use
inside of the reader's use
, and the reader is empty, will the writer's stream still be closed?JasonB
07/18/2024, 8:20 PMval reader = reader()
val writer = writer()
reader.use {
writer.use {
reader.forEach {
writer.write(it)
}
}
}
Stylianos Gakis
07/18/2024, 8:27 PMJasonB
07/18/2024, 8:29 PMuse
itself does not do any iteration, so we don't know to exit until we're inside the second use
JasonB
07/18/2024, 8:29 PM