5 ms·
This is fascinating, but it seems like it only applies to "one shot" programs, like compilers. How applicable is this in the web application space, where state
by sbjs 8y ago
This is fascinating, but it seems like it only applies to "one shot" programs, like compilers. How applicable is this in the web application space, where state is usually stored externally to the process itself? If used in the way pg's Arc was intended for making web sites easier to reason about developing, then stopping your server results in losing context for follow-up requests. Even modern desktop and mobile apps have a concept of serializing the user's current context in case the computer accidentally shuts down. Context state can't be used safely with call/cc in these situations.
- sillysaurus3 8y agoNot quite true. You can serialize a closure. Emacs lisp does so in a pretty interesting way: a closure is just `(closure ((a . 1) (b . 2)) (lambda (x) (+ x a b)))`. The point is, if you can serialize closures, I think you can serialize continuations.
- sbjs 8y agoAnd how does this work if it involves an open file handle, or some other non serializable state?
- sillysaurus3 8y agohttps://www.usenix.org/system/files/conference/atc12/atc12-final206.pdf https://www.usenix.org/system/files/conference/atc12/atc12-f...
- sillysaurus3 8y agoAlso https://github.com/tvcutsem/schemeken https://github.com/tvcutsem/schemeken is quite interesting, as is https://github.com/supergillis/v8-ken https://github.com/supergillis/v8-ken
- fulafel 8y agoThere are continuation based server-side web frameworks that will serialize & restore the continuation from storage between web requests. Eg Seaside. Rhino can also serialize continuations, there might be a web framework for it too. For frontend, there are some nontrivial transformations needed to compile continuation based code for a JS target. You can't use the native stack, etc. (Same for WebAssembly I gather, judging from the recent Go/WebAssembly implementation discussion)
- riffraff 8y agoI seem to remember Cocoon was using continuations, and there was a framework for ruby inspired by seaside but I don't know what happened to it. To add to what you wrote, the elevator pitch of Seaside and the likes is that we basically write web pages as a sea of GOTO statements and global state, the use of continuations allows us to get to the "structured programming and function calls" level.
- agumonkey 8y agoI think HN used continuations