Special delivery: programming with mailbox types

Fowler, S. , Attard, D. P., Sowul, F., Gay, S. and Trinder, P. (2023) Special delivery: programming with mailbox types. Proceedings of the ACM on Programming Languages, 7(ICFP), 191. (doi: 10.1145/3607832)

[img] Text
298712.pdf - Published Version
Available under License Creative Commons Attribution.

427kB

Abstract

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.

Item Type:Articles
Additional Information:This work was supported by EPSRC Grant EP/T014628/1 (STARDUST).
Status:Published
Refereed:Yes
Glasgow Author(s) Enlighten ID:Attard, Mr Duncan Paul and Gay, Professor Simon and Sowul, Mr Franciszek and Fowler, Dr Simon and Trinder, Professor Phil
Authors: Fowler, S., Attard, D. P., Sowul, F., Gay, S., and Trinder, P.
College/School:College of Science and Engineering > School of Computing Science
Journal Name:Proceedings of the ACM on Programming Languages
Publisher:ACM
ISSN:2475-1421
ISSN (Online):2475-1421
Published Online:31 August 2023
Copyright Holders:© 2023 Copyright held by the owner/author(s).
First Published:First published in Proceedings of the ACM on Programming Languages 7(ICFP):191
Publisher Policy:Reproduced under a Creative Commons license

University Staff: Request a correction | Enlighten Editors: Update this record

Project CodeAward NoProject NamePrincipal InvestigatorFunder's NameFunder RefLead Dept
306912Session Types for Reliable Distributed SystemsSimon GayEngineering and Physical Sciences Research Council (EPSRC)EP/T014628/1Computing Science