From Iterators to Computations and Beyond

semanticscholar(2017)

引用 0|浏览9
暂无评分
摘要
Many applications today have to perform potentially longrunning operations, typically arising from network access, calling a database or web service, or performing I/O operations in general. Whilst often peripheral to the main purpose of the application, these operations can have a big impact on the overall codebase. To stop these long-running operations blocking the main calling thread, the current practice is to use non-blocking, asynchronous operations instead. Asynchronous operations are typically issued by passing callbacks, which quickly leads to a mess of continuation passing code. This not only inverts the control structure of the original application, but also prevents the programmer from using standard control-flow constructs. Whilst perhaps acceptable to a functional programmer, this mode of programming is especially debilitating for the imperative programmer, who is accustomed to writing code using stateful loops, mutating local variables and so on. All this state must be manually saved, before initiating the asynchronous operation, then restored upon resumption, in its callback. In this paper we describe a simple yet expressive technique for writing strongly typed, asynchronous code in a familiar sequential style in C and related languages. Our proposal does not require either extensions to the language or to the runtime, but builds on existing support for iterators.
更多
查看译文
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要