skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Reusable

Exceptional asynchronous session types: session types without tiers

Published:02 January 2019Publication History
Skip Abstract Section

Abstract

Session types statically guarantee that communication complies with a protocol. However, most accounts of session typing do not account for failure, which means they are of limited use in real applications---especially distributed applications---where failure is pervasive.

We present the first formal integration of asynchronous session types with exception handling in a functional programming language. We define a core calculus which satisfies preservation and progress properties, is deadlock free, confluent, and terminating.

We provide the first implementation of session types with exception handling for a fully-fledged functional programming language, by extending the Links web programming language; our implementation draws on existing work on effect handlers. We illustrate our approach through a running example of two-factor authentication, and a larger example of a session-based chat application where communication occurs over session-typed channels and disconnections are handled gracefully.

Skip Supplemental Material Section

Supplemental Material

a28-fowler.webm

References

  1. Manuel Adameit, Kirstin Peters, and Uwe Nestmann. 2017. Session types for link failures. In FORTE (Lecture Notes in Computer Science), Vol. 10321. Springer, 1–16.Google ScholarGoogle Scholar
  2. H. P. Barendregt. 1984. The Lambda Calculus Its Syntax and Semantics (revised ed.). Vol. 103. North Holland.Google ScholarGoogle Scholar
  3. Nick Benton and Andrew Kennedy. 2001. Exceptional Syntax. Journal of Functional Programming 11, 4 (2001), 395–410. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Luís Caires and Jorge A Pérez. 2017. Linearity, control effects, and behavioral types. In ESOP (Lecture Notes in Computer Science). Springer, 229–259. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Luís Caires and Frank Pfenning. 2010. Session types as intuitionistic linear propositions. In CONCUR (Lecture Notes in Computer Science), Vol. 10. Springer, 222–236. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Marco Carbone, Ornela Dardha, and Fabrizio Montesi. 2014. Progress as compositional lock-freedom. In COORDINATION (Lecture Notes in Computer Science). Springer, 49–64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Marco Carbone, Kohei Honda, and Nobuko Yoshida. 2008. Structured interactional exceptions in session types. In CONCUR (Lecture Notes in Computer Science). Springer, 402–417. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Marco Carbone, Sam Lindley, Fabrizio Montesi, Carsten Schürmann, and Philip Wadler. 2016. Coherence generalises duality: A logical explanation of multiparty session types. In CONCUR (LIPIcs), Vol. 59. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 33:1–33:15.Google ScholarGoogle Scholar
  9. Tzu-Chun Chen, Malte Viering, Andi Bejleri, Lukasz Ziarek, and Patrick Eugster. 2016. A type theory for robust failure handling in distributed systems. In FORTE (Lecture Notes in Computer Science), Vol. 9688. Springer, 96–113. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. David Gerard Clarke. 2003. Object Ownership and Containment. Ph.D. Dissertation. New South Wales, Australia. AAI0806678.Google ScholarGoogle Scholar
  11. Ezra Cooper. 2009. Programming Language Features for Web Application Development. Ph.D. Dissertation. University of Edinburgh.Google ScholarGoogle Scholar
  12. Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. 2007. Links: Web programming without tiers. In FMCO (Lecture Notes in Computer Science). Springer, 266–296. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ornela Dardha, Elena Giachino, and Davide Sangiorgi. 2017. Session types revisited. Inf. Comput. 256 (2017), 253–286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Romain Demangeon and Kohei Honda. 2012. Nested protocols in session types. In CONCUR (Lecture Notes in Computer Science), Vol. 7454. Springer, 272–286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ian Fette and Alexey Melnikov. 2011. The WebSocket Protocol. RFC 6455. RFC Editor. 70 pages. http://www.rfc- editor.org/ rfc/rfc6455.txtGoogle ScholarGoogle Scholar
  16. Simon Fowler. 2016. An Erlang implementation of multiparty session actors. In ICE (EPTCS), Vol. 223. 36–50.Google ScholarGoogle ScholarCross RefCross Ref
  17. Simon Fowler, Sam Lindley, J. Garrett Morris, and Sára Decova. 2018. Exceptional Asynchronous Session Types: Session Types without Tiers (extended version). http://www.simonjf.com/writing/zap- extended.pdf . (2018).Google ScholarGoogle Scholar
  18. Simon J Gay and Vasco T Vasconcelos. 2010. Linear type theory for asynchronous session types. Journal of Functional Programming 20, 1 (2010), 19–50. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Daniel Hillerström and Sam Lindley. 2016. Liberating effects with rows and handlers. In [email protected]. ACM, 15–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Daniel Hillerström, Sam Lindley, Robert Atkey, and K. C. Sivaramakrishnan. 2017. Continuation passing style for effect handlers. In FSCD (LIPIcs), Vol. 84. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 18:1–18:19.Google ScholarGoogle Scholar
  21. Kohei Honda. 1993. Types for dyadic interaction. In CONCUR (Lecture Notes in Computer Science). Springer, 509–523. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Kohei Honda, Vasco T Vasconcelos, and Makoto Kubo. 1998. Language primitives and type discipline for structured communication-based programming. In ESOP (Lecture Notes in Computer Science). Springer, 122–138. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2016. Multiparty asynchronous session types. Journal of the ACM (JACM) 63, 1 (2016), 9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Raymond Hu, Nobuko Yoshida, and Kohei Honda. 2008. Session-based distributed programming in Java. In ECOOP (Lecture Notes in Computer Science). Springer, 516–541. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Thomas Bracht Laumann Jespersen, Philip Munksgaard, and Ken Friis Larsen. 2015. Session types for Rust. In WGP. ACM, 13–22. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Naoki Kobayashi. 2002. Type systems for concurrent programs. In 10th Anniversary Colloquium of UNU/IIST (Lecture Notes in Computer Science), Vol. 2757. Springer, 439–453.Google ScholarGoogle Scholar
  27. Wen Kokke. 2018. rusty-variation : a library for deadlock-free session-typed communication in Rust. https://github.com/ wenkokke/rusty- variation . (2018).Google ScholarGoogle Scholar
  28. Sam Lindley and J. Garrett Morris. 2015. A semantics for propositions as sessions. In ESOP (Lecture Notes in Computer Science), Vol. 9032. Springer, 560–584.Google ScholarGoogle Scholar
  29. Sam Lindley and J Garrett Morris. 2016. Talking bananas: structural recursion for session types. In ICFP. ACM, 434–447. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Sam Lindley and J Garrett Morris. 2017. Lightweight functional session types. In Behavioural Types: from Theory to Tools. River Publishers, 265–286.Google ScholarGoogle Scholar
  31. Nicholas D. Matsakis and Felix S. Klock II. 2014. The Rust language. In HILT. ACM, 103–104. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Karl Mazurak, Jianzhou Zhao, and Steve Zdancewic. 2010. Lightweight linear types in System F°. In TLDI. ACM, 77–88. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Robin Milner. 1999. Communicating and mobile systems: the pi calculus. Cambridge university press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Dimitris Mostrous and Vasco Thudichum Vasconcelos. 2014. Affine Sessions. In COORDINATION (Lecture Notes in Computer Science), Vol. 8459. Springer, 115–130. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Rumyana Neykova and Nobuko Yoshida. 2014. Multiparty session actors. In COORDINATION (Lecture Notes in Computer Science), Vol. 8459. Springer, 131–146. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Rumyana Neykova and Nobuko Yoshida. 2017a. Let it recover: multiparty protocol-induced recovery. In CC. ACM, 98–108. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Rumyana Neykova and Nobuko Yoshida. 2017b. Multiparty session actors. Logical Methods in Computer Science 13, 1 (2017).Google ScholarGoogle Scholar
  38. Luca Padovani. 2017. A simple library implementation of binary sessions. Journal of Functional Programming 27 (2017), e4.Google ScholarGoogle ScholarCross RefCross Ref
  39. Jorge A Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. 2012. Linear logical relations for session-based concurrency. In ESOP (Lecture Notes in Computer Science). Springer, 539–558.Google ScholarGoogle Scholar
  40. Gordon D. Plotkin and Matija Pretnar. 2013. Handling algebraic effects. Logical Methods in Computer Science 9, 4 (2013).Google ScholarGoogle Scholar
  41. Didier Rémy. 1994. Type inference for records in a natural extension of ML. In Theoretical Aspects Of Object-Oriented Programming, Carl A. Gunter and John C. Mitchell (Eds.). MIT Press, Cambridge, MA, 67–95.Google ScholarGoogle Scholar
  42. Alceste Scalas, Ornela Dardha, Raymond Hu, and Nobuko Yoshida. 2017. A linear decomposition of multiparty sessions for safe distributed programming. In ECOOP (LIPIcs), Vol. 74. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 24:1–24:31.Google ScholarGoogle Scholar
  43. Alceste Scalas and Nobuko Yoshida. 2016. Lightweight session programming in scala. In ECOOP (LIPIcs), Vol. 56. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 21:1–21:28.Google ScholarGoogle Scholar
  44. Jérôme Vouillon. 2008. Lwt: a cooperative thread library. In ML. ACM, 3–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Philip Wadler. 2014. Propositions as sessions. Journal of Functional Programming 24, 2-3 (2014), 384–418.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Exceptional asynchronous session types: session types without tiers

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!