Special Delivery: Programming with Mailbox Types (Extended Version)

06/22/2023
by   Simon Fowler, et al.
0

The asynchronous and unidirectional communication model supported by mailboxes is a key reason for the success of actor languages like Erlang and Elixir for implementing reliable and scalable distributed systems. While many actors may send messages to some actor, only the actor may (selectively) receive from its mailbox. Although actors eliminate many of the issues stemming from shared memory concurrency, they remain vulnerable to communication errors such as protocol violations and deadlocks. Mailbox types are a novel behavioural type system for mailboxes first introduced for a process calculus by de'Liguoro and Padovani in 2018, which capture the contents of a mailbox as a commutative regular expression. Due to aliasing and nested evaluation contexts, moving from a process calculus to a programming language is challenging. This paper presents Pat, the first programming language design incorporating mailbox types, and describes an algorithmic type system. We make essential use of quasi-linear typing to tame some of the complexity introduced by aliasing. Our algorithmic type system is necessarily co-contextual, achieved through a novel use of backwards bidirectional typing, and we prove it sound and complete with respect to our declarative type system. We implement a prototype type checker, and use it to demonstrate the expressiveness of Pat on a factory automation case study and a series of examples from the Savina actor benchmark suite.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
06/13/2023

The Undecidability of Typability in the Lambda-Pi-Calculus

The set of pure terms which are typable in the λΠ-calculus in a given co...
research
02/19/2018

Implementing distributed λ-calculus interpreter

This paper describes how one can implement distributed λ-calculus interp...
research
04/15/2019

A Path To DOT: Formalizing Fully-Path-Dependent Types

The Dependent Object Types (DOT) calculus aims to formalize the Scala pr...
research
07/20/2023

An Exceptional Actor System (Functional Pearl)

The Glasgow Haskell Compiler is known for its feature-laden runtime syst...
research
10/30/2020

Advanced Join Patterns for the Actor Model based on CEP Techniques

Context: Actor-based programming languages offer many essential features...
research
08/17/2017

Towards Algorithmic Typing for DOT

The Dependent Object Types (DOT) calculus formalizes key features of Sca...
research
01/12/2018

Mailbox Types for Unordered Interactions

We propose a type system for reasoning on protocol conformance and deadl...

Please sign up or login with your details

Forgot password? Click here to reset