News for hackers. Stuff that matters.
Re:Coroutines for Go by aaronbee on Monday July 17, 2023 @06:08PM (#36764735)
Your code is an example of a "pull iterator", and it's not as much of a concern.

The harder case to deal with is a "push iterator", which are often much simpler to implement, but less flexible to use. See https://github.com/golang/go/discussions/56413

The OP is about converting a push iterator into a pull iterator efficiently by using coroutines. This provides the best of both worlds, simple iterator implementation and flexible use by its caller.

There are no comments on this comment yet.