3 ms·
The missing feature you're describing is monads. They can essentially be a first-class abstraction for computation (among other things). They can represent sync
by wavemode 3y ago
The missing feature you're describing is monads. They can essentially be a first-class abstraction for computation (among other things). They can represent synchronous computations, computations that can be suspended/resumed, computations that might fail with a particular type of exception, or anything in between.
- Karrot_Kream 3y agoThis is one way to structure it but not the only. Scheme's call-with-current-continuation comes to mind here.
- code_biologist 3y agoOne really nifty use case of continuations is the Seaside Smalltalk web framework [1]. It implements stateful request/response conversations with Smalltalk's ability to capture and serialize continuations. Continuation-based web frameworks are really nifty, but have potential scaling bottlenecks. IIRC HN originally used some type of continuation web framework with Arc, but ran into scaling and caching headaches. Dunno how it works these days. [1] https://en.wikipedia.org/wiki/Seaside_(software) https://en.wikipedia.org/wiki/Seaside_(software)
- codesnik 3y agoI didn't know it can serialize continuation! I always thought that with seaside you have to run a single server, and any reboot would just kill the state.
- alexisread 3y agoI didn't think callCC can do multiple resumptions? DDBinding certainly can, and can do partial environment closures so you can migrate a process to a different machine as well: https://okmij.org/ftp/papers/DDBinding.pdf https://okmij.org/ftp/papers/DDBinding.pdf The above is succinctly implemented in wat: https://github.com/manuel/wat-js https://github.com/manuel/wat-js (also see forks for more documented versions).