Abstract
Session types describe patterns of interaction on communicating channels. Traditional session types include a form of choice whereby servers offer a collection of options, of which each client picks exactly one. This sort of choice constitutes a particular case of separated choice: offering on one side, selecting on the other. We introduce mixed choices in the context of session types and argue that they increase the flexibility of program development at the same time that they reduce the number of synchronisation primitives to exactly one. We present a type system incorporating subtyping and prove preservation and absence of runtime errors for well-typed processes. We further show that classical (conventional) sessions can be faithfully and tightly embedded in mixed choices. Finally, we discuss algorithmic type checking and a runtime system built on top of a conventional (choice-less) message-passing architecture.
Chapter PDF
Similar content being viewed by others
References
Almeida, B., Mordido, A., Vasconcelos, V.T.: Checking the equivalence of context-free session types. In: Tools and Algorithms for the Construction and Analysis of Systems - 26th International Conference, TACAS 2020. Lecture Notes in Computer Science, Springer (2020)
Barendregt, H.P.: The lambda calculus - its syntax and semantics, Studies in logic and the foundations of mathematics, vol. 103. North-Holland (1985)
Bergstra, J.A., Klop, J.W.: Process theory based on bisimulation semantics. In: Linear Time, Branching Time and Partial Order in Logics and Models for Concurrency. Lecture Notes in Computer Science, vol. 354, pp. 50–122. Springer (1988). https://doi.org/10.1007/BFb0013021
Bernardi, G., Dardha, O., Gay, S.J., Kouzapas, D.: On duality relations for session types. In: Trustworthy Global Computing. Lecture Notes in Computer Science, vol. 8902, pp. 51–66. Springer (2014). https://doi.org/10.1007/978-3-662-45917-1_4
Bernardi, G., Hennessy, M.: Using higher-order contracts to model session types. Logical Methods in Computer Science 12(2) (2016). https://doi.org/10.2168/LMCS-12(2:10)2016
Bono, V., Messa, C., Padovani, L.: Typing copyless message passing. In: Programming Languages and Systems. Lecture Notes in Computer Science, vol. 6602, pp. 57–76. Springer (2011). https://doi.org/10.1007/978-3-642-19718-5_4
Bono, V., Padovani, L.: Typing copyless message passing. Logical Methods in Computer Science 8(1) (2012). https://doi.org/10.2168/LMCS-8(1:17)2012
Caires, L., Pfenning, F., Toninho, B.: Linear logic propositions as session types. Mathematical Structures in Computer Science 26(3), 367–423 (2016). https://doi.org/10.1017/S0960129514000218
Demangeon, R., Honda, K.: Full abstraction in a subtyped pi-calculus with linear types. In: CONCUR 2011 - Concurrency Theory. Lecture Notes in Computer Science, vol. 6901, pp. 280–296. Springer (2011). https://doi.org/10.1007/978-3-642-23217-6_19
Fähndrich, M., Aiken, M., Hawblitzel, C., Hodson, O., Hunt, G.C., Larus, J.R., Levi, S.: Language support for fast and reliable message-based communication in singularity OS. In: Proceedings of the 2006 EuroSys Conference. pp. 177–190. ACM (2006). https://doi.org/10.1145/1217935.1217953
Fowler, S., Lindley, S., Morris, J.G., Decova, S.: Exceptional asynchronous session types: session types without tiers. PACMPL 3(POPL), 28:1–28:29 (2019). https://doi.org/10.1145/3290341
Franco, J., Vasconcelos, V.T.: A concurrent programming language with refined session types. In: Software Engineering and Formal Methods. Lecture Notes in Computer Science, vol. 8368, pp. 15–28. Springer (2013). https://doi.org/10.1007/978-3-319-05032-4_2
Garrigue, J., Keller, G., Sumii, E. (eds.): Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ICFP 2016, Nara, Japan, September 18–22, 2016. ACM (2016). https://doi.org/10.1145/2951913
Gastin, P., Laroussinie, F. (eds.): CONCUR 2010 - Concurrency Theory, 21th International Conference, CONCUR 2010, Paris, France, August 31-September 3, 2010. Proceedings, Lecture Notes in Computer Science, vol. 6269. Springer (2010). https://doi.org/10.1007/978-3-642-15375-4
Gay, S.J., Hole, M.: Subtyping for session types in the pi calculus. Acta Inf. 42(2–3), 191–225 (2005). https://doi.org/10.1007/s00236-005-0177-z
Gay, S.J., Vasconcelos, V.T.: Linear type theory for asynchronous session types. J. Funct. Program. 20(1), 19–50 (2010). https://doi.org/10.1017/S0956796809990268
Gorla, D.: Towards a unified approach to encodability and separation results for process calculi. Inf. Comput. 208(9), 1031–1053 (2010). https://doi.org/10.1016/j.ic.2010.05.002
Honda, K.: Types for dyadic interaction. In: CONCUR ’93, 4th International Conference on Concurrency Theory. Lecture Notes in Computer Science, vol. 715, pp. 509–523. Springer (1993). https://doi.org/10.1007/3-540-57208-2_35
Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type discipline for structured communication-based programming. In: Programming Languages and Systems. Lecture Notes in Computer Science, vol. 1381, pp. 122–138. Springer (1998). https://doi.org/10.1007/BFb0053567
Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. pp. 273–284. ACM (2008). https://doi.org/10.1145/1328438.1328472
Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. J. ACM 63(1), 9:1–9:67 (2016). https://doi.org/10.1145/2827695
Kobayashi, N., Pierce, B.C., Turner, D.N.: Linearity and the pi-calculus. In: Conference Record of POPL’96. pp. 358–371. ACM Press (1996). https://doi.org/10.1145/237721.237804
Kobayashi, N., Pierce, B.C., Turner, D.N.: Linearity and the pi-calculus. ACM Trans. Program. Lang. Syst. 21(5), 914–947 (1999). https://doi.org/10.1145/330249.330251
Kouzapas, D., Yoshida, N.: Mixed-choice multiparty session types (2020), unpublished
Lindley, S., Morris, J.G.: Talking bananas: structural recursion for session types. In: Garrigue et al. [13], pp. 434–447. https://doi.org/10.1145/2951913.2951921
Milner, R.: A Calculus of Communicating Systems, Lecture Notes in Computer Science, vol. 92. Springer (1980). https://doi.org/10.1007/3-540-10235-3
Milner, R.: Functions as processes. In: Automata, Languages and Programming. Lecture Notes in Computer Science, vol. 443, pp. 167–180. Springer (1990). https://doi.org/10.1007/BFb0032030
Milner, R.: The polyadic pi-calculus: A tutorial. ECS-LFCS 91–180, Lab oratory for Foundations of Computer Science, Department of Computer Science, University of Edinburgh (1991), this report was published in F. L. Hamer, W. Brauer and H. Schwichtenberg, editors, Logic and Algebra of Specification. Springer-Verlag, 1993
Milner, R.: Functions as processes. Mathematical Structures in Computer Science 2(2), 119–141 (1992). https://doi.org/10.1017/S0960129500001407
Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes. I. Inf. Comput. 100(1), 1–40 (1992). https://doi.org/10.1016/0890-5401(92)90008-4
Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes. II. Inf. Comput. 100(1), 41–77 (1992). https://doi.org/10.1016/0890-5401(92)90009-5
Palamidessi, C.: Comparing the expressive power of the synchronous and asynchronous pi-calculi. Mathematical Structures in Computer Science 13(5), 685–719 (2003). https://doi.org/10.1017/S0960129503004043
Peters, K., Nestmann, U.: Breaking symmetries. Mathematical Structures in Computer Science 26(6), 1054–1106 (2016). https://doi.org/10.1017/S0960129514000346
Peters, K., Schicke, J., Nestmann, U.: Synchrony vs causality in the asynchronous pi-calculus. In: Proceedings 18th International Workshop on Expressiveness in Concurrency. EPTCS, vol. 64, pp. 89–103 (2011). https://doi.org/10.4204/EPTCS.64.7
Peters, K., Schicke-Uffmann, J., Goltz, U., Nestmann, U.: Synchrony versus causality in distributed systems. Mathematical Structures in Computer Science 26(8), 1459–1498 (2016). https://doi.org/10.1017/S0960129514000644
Pierce, B.C., Turner, D.N.: Pict: a programming language based on the pi-calculus. In: Proof, Language, and Interaction, Essays in Honour of Robin Milner. pp. 455–494. The MIT Press (2000)
Sangiorgi, D.: An interpretation of typed objects into typed pi-calculus. Inf. Comput. 143(1), 34–73 (1998). https://doi.org/10.1006/inco.1998.2711
Sangiorgi, D., Walker, D.: The Pi-Calculus - a theory of mobile processes. Cambridge University Press (2001)
Stengel, Z., Bultan, T.: Analyzing singularity channel contracts. In: Proceedings of the Eighteenth International Symposium on Software Testing and Analysis. pp. 13–24. ACM (2009). https://doi.org/10.1145/1572272.1572275
Strom, R.E., Yemini, S.: Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Software Eng. 12(1), 157–171 (1986). https://doi.org/10.1109/TSE.1986.6312929
Takeuchi, K., Honda, K., Kubo, M.: An interaction-based language and its typing system. In: PARLE ’94: Parallel Architectures and Languages Europe. Lecture Notes in Computer Science, vol. 817, pp. 398–413. Springer (1994). https://doi.org/10.1007/3-540-58184-7_118
Thiemann, P., Vasconcelos, V.T.: Context-free session types. In: Garrigue et al. [13], pp. 462–475. https://doi.org/10.1145/2951913.2951926
Vasconcelos, V.T.: Fundamentals of session types. Inf. Comput. 217, 52–70 (2012). https://doi.org/10.1016/j.ic.2012.05.002
Vasconcelos, V.T.: Typed concurrent objects. In: Object-Oriented Programming. Lecture Notes in Computer Science, vol. 821, pp. 100–117. Springer (1994). https://doi.org/10.1007/BFb0052178
Vasconcelos, V.T.: Fundamentals of session types. In: Formal Methods for Web Services. Lecture Notes in Computer Science, vol. 5569, pp. 158–186. Springer (2009). https://doi.org/10.1007/978-3-642-01918-0_4
Wadler, P.: Propositions as sessions. In: ACM SIGPLAN International Conference on Functional Programming. pp. 273–286. ACM (2012). https://doi.org/10.1145/2364527.2364568
Wadler, P.: Propositions as sessions. J. Funct. Program. 24(2–3), 384–418 (2014). https://doi.org/10.1017/S095679681400001X
Waker, D.: Advanced Topics in Types and Programming Languages, chap. The MIT Press, Substructural Type Systems (2005)
Yoshida, N., Vasconcelos, V.T.: Language primitives and type discipline for structured communication-based programming revisited: Two systems for higher-order session communication. Electr. Notes Theor. Comput. Sci. 171(4), 73–93 (2007). https://doi.org/10.1016/j.entcs.2007.02.056
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Copyright information
© 2020 The Author(s)
About this paper
Cite this paper
Vasconcelos, V.T., Casal, F., Almeida, B., Mordido, A. (2020). Mixed Sessions. In: Müller, P. (eds) Programming Languages and Systems. ESOP 2020. Lecture Notes in Computer Science(), vol 12075. Springer, Cham. https://doi.org/10.1007/978-3-030-44914-8_26
Download citation
DOI: https://doi.org/10.1007/978-3-030-44914-8_26
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-44913-1
Online ISBN: 978-3-030-44914-8
eBook Packages: Computer ScienceComputer Science (R0)