Re:Coroutines for Go
by usrbinbash on Tuesday July 18, 2023 @02:34AM
(#36768663)
> The use case motivating all the complexity is function iterators
Why though?
I can get that using a simple channel. The generator sends messages to it instead of "yielding" them. When it's done, it closes the channel. The consumer ranges over the channel.
There, done, function iterator. No library required. No additions to the language required.
Why though?
I can get that using a simple channel. The generator sends messages to it instead of "yielding" them. When it's done, it closes the channel. The consumer ranges over the channel.
There, done, function iterator. No library required. No additions to the language required.