Hacker News new | ask | show | jobs
by codemac 3526 days ago
Any examples of using continuations to abort when the calculation is too large? Still grappling with continuations, familiar with coroutines/csp/fibers much more for concurrency, but trying to get call/cc fully under the belt.
1 comments

I'd probably nest a named let inside a continuation. Raise an exception when an iterator goes too long. Something like that.

I tend to avoid continuations in production code, because how it reacts very much depends on what you're accomplishing. Most exception handling frameworks use continuations, which you can accidentally turn into infinite loops if you don't abort the loop properly.