On page 85 of “Concurrency in GO” the author Katherine Cox writes “…remember you can always create go generators for this code …”
What are code generators, are they a property of the GO language or just a figure of speech ?
On page 85 of “Concurrency in GO” the author Katherine Cox writes “…remember you can always create go generators for this code …”
What are code generators, are they a property of the GO language or just a figure of speech ?
Hi,
No, generators are not a builtin feature of Go contrary to Python or JS for example.
In this context, they’re exactly what they’re supposed to be : they generate value by value at each call instead of returning all. You’ve got an example in the same book page 104 : the generator accepts a list of integers and return a channel where each integer will be sent one by one.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.