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

Gradual session types

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

Session types are a rich type discipline, based on linear types, that lift the sort of safety claims that come with type systems to communications. However, web-based applications and micro services are often written in a mix of languages, with type disciplines in a spectrum between static and dynamic typing. Gradual session types address this mixed setting by providing a framework which grants seamless transition between statically typed handling of sessions and any required degree of dynamic typing.

We propose GradualGV as an extension of the functional session type system GV with dynamic types and casts. We demonstrate type and communication safety as well as blame safety, thus extending previous results to functional languages with session-based communication. The interplay of linearity and dynamic types requires a novel approach to specifying the dynamics of the language.

Skip Supplemental Material Section

Supplemental Material

References

  1. Felipe Bañados Schwerter, Ronald Garcia, and Éric Tanter. 2014. A theory of gradual effect systems. In International Conference on Functional Programming (ICFP). ACM, 283–295.Google ScholarGoogle Scholar
  2. H.P. Barendregt. 1984. The Lambda Calculus: Its Syntax and Semantics. North-Holland.Google ScholarGoogle Scholar
  3. Andrej Bauer and Matija Pretnar. 2015. Programming with algebraic effects and handlers. Journal of Logical and Algebraic Methods in Programming 84, 1 (2015), 108–123. Google ScholarGoogle ScholarCross RefCross Ref
  4. Gavin Bierman, Martin Abadi, and Mads Torgersen. 2014. Understanding TypeScript. In European Conference on ObjectOriented Programming (ECOOP) (LNCS), Vol. 8586. Springer, 257–281. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Gavin M. Bierman, Erik Meijer, and Mads Torgersen. 2010. Adding dynamic types to C#. In European Conference on Object-Oriented Programming (ECOOP) (LNCS). Springer, 76–100.Google ScholarGoogle Scholar
  6. Laura Bocchi, Tzu-Chun Chen, Romain Demangeon, Kohei Honda, and Nobuko Yoshida. 2017. Monitoring networks through multiparty session types. Theoretical Computer Science 699 (2017), 33–58. Google ScholarGoogle ScholarCross RefCross Ref
  7. Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming 23, 05 (2013), 552–593. Google ScholarGoogle ScholarCross RefCross Ref
  8. Luís Caires and Frank Pfenning. 2010. Session types as intuitionistic linear propositions. In International Conference on Concurrency Theory (CONCUR) (LNCS). Springer, 222–236. Google ScholarGoogle ScholarCross RefCross Ref
  9. Luis Caires, Frank Pfenning, and Bernardo Toninho. 2014. Linear logic propositions as session types. Mathematical Structures in Computer Science 26, 03 (2014), 367–423. Google ScholarGoogle ScholarCross RefCross Ref
  10. Adam Chlipala. 2013. Certified Programming with Dependent Types: A Pragmatic Introduction to the Coq Proof Assistant. MIT Press.Google ScholarGoogle Scholar
  11. Manuel Fähndrich, Mark Aiken, Chris Hawblitzel, Orion Hodson, Galen C. Hunt, James R. Larus, and Steven Levi. 2006. Language support for fast and reliable message-based communication in Singularity OS. In European Conference on Computer Systems (EuroSys). ACM, 177–190. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Luminous Fennell and Peter Thiemann. 2012. The Blame Theorem for a Linear Lambda Calculus with Type Dynamic. In Trends in Functional Programming (LNCS), Vol. 7829. Springer, 37–52.Google ScholarGoogle Scholar
  13. Robert Bruce Findler and Matthias Felleisen. 2002. Contracts for Higher-Order Functions. In International Conference on Functional Programming (ICFP). ACM, 48–59. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Cormac Flanagan. 2006. Hybrid Type Checking. In Principles of Programming Languages (POPL). ACM, 245–256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Simon Fowler. 2016. An Erlang Implementation of Multiparty Session Actors. In Interaction and Concurrency Experience. 36–50. Google ScholarGoogle ScholarCross RefCross Ref
  16. Juliana Franco and Vasco Thudichum Vasconcelos. 2013. A Concurrent Programming Language with Refined Session Types. In SEFM (LNCS), Vol. 8368. Springer, 15–28.Google ScholarGoogle Scholar
  17. Ronald Garcia, Alison M. Clark, and Éric Tanter. 2016. Abstracting gradual typing. In Principles of Programming Languages (POPL). ACM, 429–442. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Simon Gay and Malcolm Hole. 2005. Subtyping for session types in the pi calculus. Acta Informatica 42, 2-3 (2005), 191–225.Google ScholarGoogle ScholarCross RefCross Ref
  19. Simon Gay and Vasco Vasconcelos. 2010. Linear type theory for asynchronous session types. Journal of Functional Programming 20, 01 (2010), 19–50. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Simon J. Gay, Vasco Thudichum Vasconcelos, António Ravara, Nils Gesbert, and Alexandre Z. Caldeira. 2010. Modular session types for distributed object-oriented programming. In Principles of Programming Languages (POPL). ACM, 299–312. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jean-Yves Girard. 1987. Linear logic. Theoretical computer science 50, 1 (1987), 1–101. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Michael Greenberg, Benjamin C. Pierce, and Stephanie Weirich. 2010. Contracts Made Manifest. In Principles of Programming Languages (POPL). ACM, 353–364. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Kohei Honda. 1993. Types for Dyadic Interaction. In International Conference on Concurrency Theory (CONCUR) (LNCS), Vol. 715. Springer, 509–523. Google ScholarGoogle ScholarCross RefCross Ref
  24. K. Honda, A. Mukhamedov, G. Brown, T. Chen, and N. Yoshida. 2011. Scribbling Interactions with a Formal Foundation. In ICDCIT (LNCS), Vol. 6536. Springer, 55–75. Google ScholarGoogle ScholarCross RefCross Ref
  25. Kohei Honda, Vasco Vasconcelos, and Makoto Kubo. 1998. Language Primitives and Type Discipline for Structured Communication-Based Programming. In European Symposium on Programming (ESOP) (LNCS). Springer, 122–138. Google ScholarGoogle ScholarCross RefCross Ref
  26. Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2008. Multiparty asynchronous session types. In Principles of Programming Languages (POPL). ACM, 273–284. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2016. Multiparty asynchronous session types. J. ACM 63, 1 (2016), 9.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Raymond Hu, Dimitrios Kouzapas, Olivier Pernet, Nobuko Yoshida, and Kohei Honda. 2010. Type-safe eventful sessions in Java. In European Conference on Object-Oriented Programming (ECOOP) (LNCS), Vol. 6183. Springer, 329–353. Google ScholarGoogle ScholarCross RefCross Ref
  29. Raymond Hu and Nobuko Yoshida. 2016. Hybrid session verification through endpoint API generation. In Fundamental Approaches to Software Engineering (FASE) (LNCS), Vol. 9633. Springer, 401–418. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Raymond Hu, Nobuko Yoshida, and Kohei Honda. 2008. Session-based distributed programming in Java. In European Conference on Object-Oriented Programming (ECOOP) (LNCS), Vol. 5142. Springer, 516–541. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Thomas Bracht Laumann Jespersen, Philip Munksgaard, and Ken Friis Larsen. 2015. Session types for Rust. In Workshop on Generic Programming (WGP). ACM, 13–22.Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Dimitrios Kouzapas, Ornela Dardha, Roly Perera, and Simon J. Gay. 2016. Typechecking protocols with Mungo and StMungo. In Principles and Practice of Declarative Programming (PPDP). ACM, 146–159. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Julien Lange, Nicholas Ng, Bernardo Toninho, and Nobuko Yoshida. 2017. Fencing off Go: liveness and safety for channelbased programming. In Principles of Programming Languages (POPL). ACM, 748–761. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Daan Leijen. 2017. Type Directed Compilation of Row-typed Algebraic Effects. SIGPLAN Not. 52, 1, 486–499. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Sam Lindley, Conor McBride, and Craig McLaughlin. 2017. Do Be Do Be Do. In Principles of Programming Languages (POPL). ACM, 500–514. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Sam Lindley and J. Garrett Morris. 2016a. Embedding session types in Haskell. In Symposium on Haskell. ACM, 133–145. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Sam Lindley and J Garrett Morris. 2016b. Talking bananas: structural recursion for session types. In International Conference on Functional Programming (ICFP). ACM, 434–447. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Sam Lindley and J. Garrett Morris. 2017. Behavioural Types: from Theory to Tools. River Publishers, Chapter Lightweight functional session types.Google ScholarGoogle Scholar
  39. Robin Milner, Joachim Parrow, and David Walker. 1992. A calculus of mobile processes, I. Information and Computation 100, 1 (1992), 1–40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Dimitris Mostrous and Vasco T. Vasconcelos. 2011. Session typing for a featherweight Erlang. In Coordination Models and Languages (COORDINATION) (LNCS), Vol. 6721. Springer, 95–109. Google ScholarGoogle ScholarCross RefCross Ref
  41. Rumyana Neykova and Nobuko Yoshida. 2014. Multiparty session actors. In Coordination Models and Languages (COORDI-NATION) (LNCS), Vol. 8459. Springer, 131–146. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Rumyana Neykova and Nobuko Yoshida. 2017. Let it recover: multiparty protocol-induced recovery. In International Conference on Compiler Construction (CC). ACM, 98–108. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Rumyana Neykova, Nobuko Yoshida, and Raymond Hu. 2013. SPY: Local Verification of Global Protocols. In International Conference on Runtime Verification (RV) (LNCS), Vol. 8174. Springer, 358–363.Google ScholarGoogle Scholar
  44. Nicholas Ng and Nobuko Yoshida. 2016. Static deadlock detection for concurrent Go by global session graph synthesis. In International Conference on Compiler Construction (CC). ACM, 174–184. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Nicholas Ng, Nobuko Yoshida, and Kohei Honda. 2012. Multiparty Session C: Safe parallel programming with message optimisation. In International Conference on Modelling Techniques and Tools for Computer Performance Evaluation (TOOLS) (LNCS), Vol. 7304. Springer, 202–218.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Ulf Norell. 2009. Dependently typed programming in Agda. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI ’09). ACM, 1–2. Google ScholarGoogle ScholarCross RefCross Ref
  47. Dominic Orchard and Nobuko Yoshida. 2016. Effects as sessions, sessions as effects. In Principles of Programming Languages (POPL). ACM, 568–581. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. 2004. Dynamic Typing with Dependent Types. In IFIP International Conference on Theoretical Computer Science, Vol. 155. Springer, 437–450. Google ScholarGoogle ScholarCross RefCross Ref
  49. Luca Padovani. 2017. A simple library implementation of binary sessions. Journal of Functional Programming 27 (2017), e4. Google ScholarGoogle ScholarCross RefCross Ref
  50. Frank Pfenning and Dennis Griffith. 2015. Polarized substructural session types. In International Conference on Foundations of Software Science and Computation Structures (LNCS), Vol. 9034. Springer, 3–22. Google ScholarGoogle ScholarCross RefCross Ref
  51. Jeff Polakow. 2015. Embedding a full linear Lambda calculus in Haskell. In Symposium on Haskell. ACM, 177–188. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Riccardo Pucella and Jesse A Tov. 2008. Haskell session types with (almost) no class. In Symposium on Haskell. ACM, 25–36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Matthew Sackman and Susan Eisenbach. 2008. Session types in Haskell: Updating message passing for the 21st century. (2008).Google ScholarGoogle Scholar
  54. Alceste Scalas and Nobuko Yoshida. 2016. Lightweight session programming in Scala. In European Conference on ObjectOriented Programming (ECOOP) (LIPIcs). Schloss Dagstuhl, 21:1–21:28.Google ScholarGoogle Scholar
  55. Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop (Scheme). 81–92.Google ScholarGoogle Scholar
  56. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John T. Boyland. 2015. Refined criteria for gradual typing. In Summit on Advances in Programming Languages (SNAPL) (LIPIcs), Vol. 32. Schloss Dagstuhl, 274–293.Google ScholarGoogle Scholar
  57. The Dart Team. 2014. Dart Programming Lanuage Specification. (2014). Google, 1.2 edition.Google ScholarGoogle Scholar
  58. Peter Thiemann. 2014. Session Types with Gradual Typing. In TGC (LNCS), Vol. 8902. Springer, 144–158. Google ScholarGoogle ScholarCross RefCross Ref
  59. Bernardo Toninho, Luís Caires, and Frank Pfenning. 2013. Higher-Order Processes, Functions, and Sessions: A Monadic Integration. In European Symposium on Programming (ESOP) (LNCS), Vol. 7792. Springer, 350–369.Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. Jesse A. Tov and Riccardo Pucella. 2010. Stateful contracts for affine types. In European Symposium on Programming (ESOP) (LNCS), Vol. 6012. Springer, 550–569. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Vasco Thudichum Vasconcelos. 2012. Fundamentals of Session Types. Information and Computation 217 (2012), 52–70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Julien Verlaguet. 2013. Facebook: Analysing PHP Statically. In Workshop on Commercial Uses of Functional Programming (CUFP).Google ScholarGoogle Scholar
  63. Philip Wadler. 2012. Propositions as sessions. In International Conference on Functional Programming (ICFP). ACM, 273–286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. Philip Wadler. 2014. Propositions as sessions. Journal of Functional Programming 24, 2-3 (2014), 384–418.Google ScholarGoogle ScholarCross RefCross Ref
  65. Philip Wadler. 2015. A Complement to Blame. In 1st Summit on Advances in Programming Languages (SNAPL) (LIPIcs), Vol. 32. Schloss Dagstuhl, 309–320.Google ScholarGoogle Scholar
  66. Philip Wadler and Robert Bruce Findler. 2009. Well-Typed Programs Can’t Be Blamed. In European Symposium on Programming (ESOP) (LNCS), Vol. 5502. Springer, 1–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  67. David Walker. 2005. Advanced Topics in Types and Programming Languages. MIT Press, Chapter Substructural Type Systems, 3–43.Google ScholarGoogle Scholar
  68. Jack Williams, J. Garrett Morris, Philip Wadler, and Jakub Zalewski. 2017. Mixed Messages: Measuring Conformance and Non-Interference in TypeScript. In European Conference on Object-Oriented Programming (ECOOP) (LIPIcs), Vol. 74. Schloss Dagstuhl, Dagstuhl, Germany, 28:1–28:29.Google ScholarGoogle Scholar
  69. Max Willsey, Rokhini Prabhu, and Frank Pfenning. 2017. Design and Implementation of Concurrent C0. In International Workshop on Linearity (EPTCS), Vol. 238. 73–82. Google ScholarGoogle ScholarCross RefCross Ref
  70. Roger Wolff, Ronald Garcia, Éric Tanter, and Jonathan Aldrich. 2011. Gradual typestate. In European Conference on ObjectOriented Programming (ECOOP) (LNCS), Vol. 6813. Springer, 459–483. Google ScholarGoogle ScholarCross RefCross Ref
  71. Nobuko Yoshida, Raymond Hu, Rumyana Neykova, and Nicholas Ng. 2014. The Scribble protocol language. In International Symposium on Trustworthy Global Computing (LNCS), Vol. 8358. Springer, 22–41. Google ScholarGoogle ScholarDigital LibraryDigital Library
  72. Nobuko Yoshida and Vasco Vasconcelos. 2007. Language primitives and type discipline for structured communication-based programming revisited: Two systems for higher-order session communication. ENTCS 171, 4 (2007), 73–93. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Gradual session types

          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