Here’s an encapsulation challenge that I frequently run into: how to let users iterate over an internal data structure without leaking implementation details, but still giving them full control over the loop?
Implementing a custom iterator type requires significant boilerplate and/or complexity, depending on the underlying data structure.
Coroutines are simple and elegant, but the codegen is atrocious – definitely unsuitable for hot paths.