Typing Composable Coroutines

Qiqi Gu, Wei Ke

研究成果: Conference contribution同行評審

摘要

Coroutine, as a powerful programming construct, is widely used in asynchronous applications to replace thread-based programming or the callback hell. Using coroutines makes code more readable and maintainable, for its ability to transfer control while keeping the literal scope. However, reasoning about coroutine behavior can be challenging without proper typing. We propose a type notation and calculus for composing asymmetric, first-class, stackless coroutines. Given the types of a list of coroutines, we can compute a composed type matching the collective behavior of the coroutines, so that the input and output can be type-checked by a type system. Our coroutine types can model the data received by or yielded from a coroutine, which be of coroutine types as well. On top of our type calculus, we discuss its soundness and evaluation issues, then provide four application scenarios of our coroutine types. Not only can our types be used in modern programming languages, such as Python, but also model program behaviors in OCaml and even Prolog.

原文English
主出版物標題Proceedings - 2023 12th International Conference on Computer Technologies and Development, TechDev 2023
發行者Institute of Electrical and Electronics Engineers Inc.
頁面16-23
頁數8
ISBN(電子)9798350381269
DOIs
出版狀態Published - 2023
事件12th International Conference on Computer Technologies and Development, TechDev 2023 - Virtual, Online, Italy
持續時間: 14 10月 202316 10月 2023

出版系列

名字Proceedings - 2023 12th International Conference on Computer Technologies and Development, TechDev 2023

Conference

Conference12th International Conference on Computer Technologies and Development, TechDev 2023
國家/地區Italy
城市Virtual, Online
期間14/10/2316/10/23

指紋

深入研究「Typing Composable Coroutines」主題。共同形成了獨特的指紋。

引用此