Hacker News new | ask | show | jobs
by happytoexplain 816 days ago
Regarding the second code snippet - I've never seen this language feature before. Obviously there are things sometimes called generators implemented as structures, where 'step' or 'next' is just a normal method, but is there a real world example of what is shown?
1 comments

Thanks for the feedback! My code snippets in the article don't use any real/existing language. C# for example, is quite explicit with the transformation of generated to state machines, but also does not provide such methods, as far as I know. I've just added a comment explaining this choice: https://github.com/Dobiasd/articles/commit/f44b897f2a4d20aa9...