Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Similar, but less general.

Serializable continuations can be saved to disk. You can reinstate a completed continuation (eg. go back from the final page. After clicking the link again, the page completes again. Or try clicking the link in several tabs; the page concurrently completes several times as you expect.) Generators make this pattern impossible; Continuations give it to you for free.

Second, by being saved on disk, they aren't crammed up in the event loop so they aren't a RAM leak. Racket even provides a way of having the client store all state if you wish; such "stateless" continuations have no memory or disk overhead on a long-running server and never expire until you change your site's source code.



In short: Generators are useful when you use callbacks to wait for the server to finish doing something (eg. finish a DB update or an HTTP request)

Continuations are useful when you're waiting for the user to finish doing something (eg. an HTTP response, not a request).

So they do solve different problems.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: