Hostname: page-component-cd9895bd7-q99xh Total loading time: 0 Render date: 2024-12-26T04:29:31.217Z Has data issue: false hasContentIssue false

A simple library implementation of binary sessions*

Published online by Cambridge University Press:  21 December 2016

LUCA PADOVANI*
Affiliation:
Dipartimento di Informatica, Università di Torino, Torino, Italy (e-mails: [email protected])
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Inspired by the continuation-passing encoding of binary sessions, we describe a simple approach to embed a hybrid form of session type checking into any programming language that supports parametric polymorphism. The approach combines static protocol analysis with dynamic linearity checks. To demonstrate the effectiveness of the technique, we implement a well-integrated OCaml module for session communications. For free, OCaml provides us with equirecursive session types, parametric behavioural polymorphism, complete session type inference, and session subtyping.

Type
Articles
Copyright
Copyright © Cambridge University Press 2016 

Footnotes

*

Supported by ICT COST Action IC1201 BETTY and MIUR Project CINA.

References

Ancona, D., Bono, V., Bravetti, M., Campos, J., Castagna, G., Deniélou, P.-M., Gay, S. J., Gesbert, N., Giachino, E., Hu, R., Johnsen, E. B., Martins, F., Mascardi, V., Montesi, F., Neykova, R., Ng, N., Padovani, L., Vasconcelos, V. T. & Yoshida, N. (2016) Behavioral types in programming languages. Found. Trends Program. Lang. 3 (2–3), 95230.Google Scholar
Bartoletti, M., Cimoli, T., Murgia, M., Podda, A.-S. & Pompianu, L. (2015) Compliance and subtyping in timed session types. In Proceedings of FORTE'15, LNCS, vol. 9039. Springer, Germany, pp. 161–177.CrossRefGoogle Scholar
Bocchi, L., Chen, T.-C., Demangeon, R., Honda, K. & Yoshida, N. (2013) Monitoring networks through multiparty session types. In Proceedings of FMOODS/FORTE'13, LNCS, vol. 7892. Springer, Germany, pp. 50–65.CrossRefGoogle Scholar
Bono, V. & Padovani, L. (2012) Typing copyless message passing. Logical Methods Comput. Sci. 8 (1:17), 150.Google Scholar
Caires, L. & Pérez, J. A. (2016) Multiparty session types within a canonical binary theory, and beyond. In Proceedings of FORTE'16, LNCS, vol. 9688. Springer, Germany, pp. 74–95.CrossRefGoogle Scholar
Chen, T.-C., Bocchi, L., Deniélou, P.-M., Honda, K. & Yoshida, N. (2011) Asynchronous distributed monitoring for multiparty session enforcement. In Proceedings of TGC'11, LNCS, vol. 7173. Springer, Germany, pp. 25–45.Google Scholar
Courcelle, B. (1983) Fundamental properties of infinite trees. Theor. Comput. Sci. 25 (2), 95169.Google Scholar
Dardha, O., Giachino, E. & Sangiorgi, D. (2012) Session types revisited. In Proceedings of PPDP'12. ACM, USA, pp. 139–150.CrossRefGoogle Scholar
Demangeon, R. & Honda, R. (2011) Full abstraction in a subtyped pi-calculus with linear types. In Proceedings of CONCUR'11, LNCS, vol. 6901. Springer, Germany, pp. 280–296.CrossRefGoogle Scholar
Demangeon, R., Honda, K., Hu, R., Neykova, R. & Yoshida, N. (2015) Practical interruptible conversations: Distributed dynamic verification with multiparty session types and python. Formal Methods Syst. Des. 46 (3), 197225.CrossRefGoogle Scholar
Garrigue, J. (1998) Programming with polymorphic variants. In Informal Proceedings of ACM SIGPLAN Workshop on ML. Available at https://caml.inria.fr/pub/papers/garrigue-polymorphic_variants-ml98.pdf, last accessed November 2016.Google Scholar
Gay, S. & Hole, M. (2005) Subtyping for session types in the π-calculus. Acta Inform. 42 (2–3), 191225.Google Scholar
Gay, S. J. & Vasconcelos, V. T. (2010) Linear type theory for asynchronous session types. J. Funct. Program. 20 (1), 1950.Google Scholar
Honda, K. (1993) Types for dyadic interaction. In Proceedings of CONCUR'93, LNCS, vol. 715. Springer, Germany, pp. 509–523.Google Scholar
Honda, K., Vasconcelos, V. T. & Kubo, M. (1998) Language primitives and type disciplines for structured communication-based programming. In Proceedings of ESOP'98, LNCS, vol. 1381. Springer, Germany, pp. 122–138.CrossRefGoogle Scholar
Honda, K., Yoshida, N. & Carbone, M. (2008) Multiparty asynchronous session types. In Proceedings of POPL'08. ACM, USA, pp. 273–284.Google Scholar
Hu, R. & Yoshida, N. (2016) Hybrid session verification through endpoint API generation. In Proceedings of FASE'16, LNCS, vol. 9633. Springer, Germany, pp. 401–418.CrossRefGoogle Scholar
Hunt, G., Larus, J. R., Abadi, M., Aiken, M., Barham, P., Fähndrich, M., Hawblitzel, C., Hodson, O., Levi, S., Murphy, N., Steensgaard, B., Tarditi, D., Wobber, T. & Zill, B. (2005) An Overview of the Singularity Project. Technical Report MSR-TR-2005-135, Microsoft Research.Google Scholar
Imai, K., Yuen, S. & Agusa, K. (2010) Session type inference in Haskell. In Proceedings of PLACES'10, EPTCS 69, Open Publishing Association, pp. 74–91.Google Scholar
Jane Street Developers. (August 2016) Core library documentation. Available at https://ocaml.janestreet.com/ocaml-core/latest/doc/core/. Last accessed in November 2016.Google Scholar
Kobayashi, N. (2002) Type systems for concurrent programs. In Proceedings of the 10th Anniversary Colloquium of UNU/IIST, LNCS, vol. 2757. Springer, Germany, pp. 439–453. Extended version available at http://www.kb.ecei.tohoku.ac.jp/koba/papers/tutorial-type-extended.pdf.CrossRefGoogle Scholar
Kobayashi, N., Pierce, B. C. & Turner, D. N. (1999) Linearity and the pi-calculus. ACM Trans. Program. Lang. Syst. 21 (5), 914947.CrossRefGoogle Scholar
Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D. & Vouillon, J. (2014) The Objective Caml System. Available at http://caml.inria.fr/pub/docs/manual-ocaml/. Last accessed in November 2016.Google Scholar
Neubauer, M. & Thiemann, P. (2004) An implementation of session types. In Proceedings of PADL'04, LNCS, vol. 3057. Springer, Germany, pp. 56–70.CrossRefGoogle Scholar
Padovani, L. (2014) Deadlock and lock freedom in the linear π-calculus. In Proceedings of CSL-LICS'14. ACM, USA, pp. 72:1–72:10. Extended version available at http://hal.archives-ouvertes.fr/hal-00932356v2/.Google Scholar
Padovani, L. (2015) A Simple Library Implementation of Binary Sessions. Technical Report, Università di Torino, Italy. Available at https://hal.archives-ouvertes.fr/hal-01216310.Google Scholar
Padovani, L. (2016) Context-Free Session Type Inference. Technical Report, Università di Torino, Italy. Available at https://hal.archives-ouvertes.fr/hal-01385258.Google Scholar
Pierce, B. C. & Sangiorgi, D. (1996) Typing and subtyping for mobile processes. Math. Struct. Comput. Sci. 6 (5), 409453.Google Scholar
Pucella, R. & Tov, J. A. (2008) Haskell session types with (almost) no class. In Proceedings of HASKELL'08. ACM, USA, pp. 25–36.CrossRefGoogle Scholar
Reppy, J. H. (1999) Concurrent Programming in ML. Cambridge University Press.CrossRefGoogle Scholar
Sackman, M. & Eisenbach, S. (2008) Session Types in Haskell: Updating Message Passing for the 21st Century. Technical report, Imperial College London. Available at http://pubs.doc.ic.ac.uk/session-types-in-haskell/.Google Scholar
Scalas, A. & Yoshida, N. (2016) Lightweight session programming in scala. In Proceedings of ECOOP'16, LIPIcs, Germany, vol. 56. Schloss Dagstuhl, pp. 21:1–21:28.Google Scholar
Tov, J. A. (2012) Practical Programming with Substructural Types. PhD thesis, Northeastern University.Google Scholar
Tov, J. A. & Pucella, R. (2010) Stateful contracts for affine types. In Proceedings of ESOP'10, LNCS, vol. 6012. Springer, Germany, pp. 550–569.Google Scholar
Tov, J. A. & Pucella, R. (2011) Practical affine types. In Proceedings of POPL'11. ACM, USA, pp. 447–458.CrossRefGoogle Scholar
Vasconcelos, V. T. & Thiemann, P. (2016) Context-free session types. In Proceedings of ICFP'16. ACM, USA, pp. 462–475.Google Scholar
Wadler, P. (2014) Propositions as sessions. J. Funct. Program. 24 (2–3), 384418.CrossRefGoogle Scholar
Wright, A. K. & Felleisen, M. (1994) A syntactic approach to type soundness. Inform. Comput. 115 (1), 3894.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.