logoalt Hacker News

robmccoll • today at 1:21 PM • 1 reply • view on HN

It's fun watching people rediscover this every so often. If you like this sort of thing, go check out creating generator functions using a switch embedded throughout your function. You can wrap it in macros to end up with a nice yield keyword emulation.


Replies

sunrunner • today at 1:35 PM

Is this essentially the mechanism behind Duff's Device (switch cases being better thought of as line-oriented jumps instead of structured blocks) but generalised?

➕ show 1 reply