Skip to main content Accessibility help
×
Home

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: luca.padovani@di.unito.it)
Corresponding
E-mail address:

Abstract

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 

Access options

Get access to the full version of this content by using one of the access options below.

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.CrossRefGoogle 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.Google 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.Google Scholar
Bono, V. & Padovani, L. (2012) Typing copyless message passing. Logical Methods Comput. Sci. 8 (1:17), 150.CrossRefGoogle 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.Google 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.CrossRefGoogle 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.Google 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.CrossRefGoogle Scholar
Gay, S. J. & Vasconcelos, V. T. (2010) Linear type theory for asynchronous session types. J. Funct. Program. 20 (1), 1950.CrossRefGoogle 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.Google Scholar
Honda, K., Yoshida, N. & Carbone, M. (2008) Multiparty asynchronous session types. In Proceedings of POPL'08. ACM, USA, pp. 273–284.CrossRefGoogle 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.Google 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.Google 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.Google 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.Google 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.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.

Altmetric attention score

Full text views

Full text views reflects PDF downloads, PDFs sent to Google Drive, Dropbox and Kindle and HTML full text views.

Total number of HTML views: 0
Total number of PDF views: 141 *
View data table for this chart

* Views captured on Cambridge Core between 21st December 2016 - 18th January 2021. This data will be updated every 24 hours.

Hostname: page-component-77fc7d77f9-fgqm6 Total loading time: 0.791 Render date: 2021-01-18T08:35:28.792Z Query parameters: { "hasAccess": "0", "openAccess": "0", "isLogged": "0", "lang": "en" } Feature Flags last update: Mon Jan 18 2021 07:56:05 GMT+0000 (Coordinated Universal Time) Feature Flags: { "metrics": true, "metricsAbstractViews": false, "peerReview": true, "crossMark": true, "comments": true, "relatedCommentaries": true, "subject": true, "clr": true, "languageSwitch": true, "figures": false, "newCiteModal": false, "shouldUseShareProductTool": true, "shouldUseHypothesis": true, "isUnsiloEnabled": true }

Send article to Kindle

To send this article to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about sending to your Kindle. Find out more about sending to your Kindle.

Note you can select to send to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be sent to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

A simple library implementation of binary sessions*
Available formats
×

Send article to Dropbox

To send this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Dropbox.

A simple library implementation of binary sessions*
Available formats
×

Send article to Google Drive

To send this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Google Drive.

A simple library implementation of binary sessions*
Available formats
×
×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *