A reoccuring problem with Iterators and sequences is that they could use underlying resources which need to be closed.
- https://github.com/Kotlin/kotlin-coroutines/issues/10
- https://youtrack.jetbrains.com/issue/KT-18961
- coroutines-examples/kotlin-coroutines-informal.md at master · Kotlin/coroutines-examples · GitHub
Would it be possible to factor all terminal operations in Sequences.kt
into an interface which can be overriden by custom sequences, to call a method like “cleanup” inside a try / catch block?