3 ms·
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
by gcr 13y ago
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.
- gcr 13y agoIn 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.