Abstract

Traditional session types prescribe bidirectional communication protocols for concurrent computations, where well-typed programs are guaranteed to adhere to the protocols. However, simple session types cannot capture properties beyond the basic type of the exchanged messages. In response, recent work has extended session types with refinements from linear arithmetic, capturing intrinsic attributes of processes and data. These refinements then play a central role in describing sequential and parallel complexity bounds on session-typed programs. The Rast language provides an open-source implementation of session-typed concurrent programs extended with arithmetic refinements as well as ergometric and temporal types to capture work and span of program execution. To further support generic programming, Rast also enhances arithmetically refined session types with recently developed nested parametric polymorphism. Type checking relies on Cooper's algorithm for quantifier elimination in Presburger arithmetic with a few significant optimizations, and a heuristic extension to nonlinear constraints. Rast furthermore includes a reconstruction engine so that most program constructs pertaining the layers of refinements and resources are inserted automatically. We provide a variety of examples to demonstrate the expressivity of the language.

Highlights

  • Session types [Hon93, HVK98, Vas12] provide a structured way of statically prescribing communication protocols in message-passing programs

  • We introduce the Rast programming language and implementation which is based on binary session types governing the interaction of two processes along a single channel, rather than multiparty session types [HYC08] which take a more global view of computation

  • The literature on session types is vast, so we focus our review of related work on binary session types with implementations

Read more

Summary

Introduction

Session types [Hon, HVK98, Vas12] provide a structured way of statically prescribing communication protocols in message-passing programs. Rast follows the design principle that bases an explicit language directly on the correspondence with the sequent calculus for the underlying logic (such as linear logic, or temporal or ergometric linear logic), extended with recursively defined types and processes. Programming in this fully explicit form tends to be unnecessarily verbose, so Rast provides an implicit language in which most constructs related to index refinements and amortized work analysis are omitted. (2) An extension with full parametric polymorphism to enable generic programming. (3) A subtyping algorithm that works well in practice despite its theoretical undecidability [DP20b] and uses Cooper’s algorithm [Coo72] with some small improvements to decide constraints in Presburger arithmetic (and heuristics for nonlinear constraints). (4) A type checking algorithm that is sound and complete relative to subtyping. (5) A sound and complete reconstruction algorithm for a process language where most index and ergometric constructs remain implicit. (6) An interpreter for executing session-typed programs using the recently proposed shared memory semantics [PP20]

Example
Basic System of Session Types
Polymorphic Session Types
Refinement Session Types
Ergometric Session Types
Temporal Session Types
Subtyping
Implementation
10. Further Examples
11. Related Work
12. Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call