Hannes Saffrich ; Peter Thiemann - Relating Functional and Imperative Session Types

lmcs:8815 - Logical Methods in Computer Science, September 15, 2022, Volume 18, Issue 3 - https://doi.org/10.46298/lmcs-18(3:33)2022
Relating Functional and Imperative Session Types

Authors: Hannes Saffrich ; Peter Thiemann

    Imperative session types provide an imperative interface to session-typed communication. In such an interface, channel references are first-class objects with operations that change the typestate of the channel. Compared to functional session type APIs, the program structure is simpler at the surface, but typestate is required to model the current state of communication throughout. Following an early work that explored the imperative approach, a significant body of work on session types has neglected the imperative approach and opts for a functional approach that uses linear types to manage channel references soundly. We demonstrate that the functional approach subsumes the early work on imperative session types by exhibiting a typing and semantics preserving translation into a system of linear functional session types. We further show that the untyped backwards translation from the functional to the imperative calculus is semantics preserving. We restrict the type system of the functional calculus such that the backwards translation becomes type preserving. Thus, we precisely capture the difference in expressiveness of the two calculi and conclude that the lack of expressiveness in the imperative calculus is largely due to restrictions imposed by its type system.

    Volume: Volume 18, Issue 3
    Published on: September 15, 2022
    Accepted on: August 25, 2022
    Submitted on: December 8, 2021
    Keywords: Computer Science - Programming Languages,D.1.3,D.3.1,F.3.2


    Consultation statistics

    This page has been seen 454 times.
    This article's PDF has been downloaded 168 times.