
TL;DR
This paper introduces a type notation and calculus for composing and reasoning about stackless coroutines, enhancing type safety and understanding in asynchronous programming across multiple languages.
Contribution
It proposes a novel type calculus for asymmetric, first-class coroutines that models their behavior and supports type checking in various programming languages.
Findings
Type calculus can model coroutine data flow and behavior.
The proposed types are applicable in Python, OCaml, and Prolog.
Discussion includes soundness and evaluation of the type system.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Logic, programming, and type systems · Natural Language Processing Techniques
