Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

The Chemical Approach to Typestate-Oriented Programming

Published: 26 May 2017 Publication History

Abstract

We introduce a novel approach to typestate-oriented programming based on the chemical metaphor: state and operations on objects are molecules of messages, and state transformations are chemical reactions. This approach allows us to investigate typestate in an inherently concurrent setting, whereby objects can be accessed and modified concurrently by several processes, each potentially changing only part of their state. We introduce a simple behavioral type theory to express in a uniform way both the private and the public interfaces of objects; describe and enforce structured object protocols consisting of possibilities, prohibitions, and obligations; and control object sharing.

References

[1]
Gul Agha. 1986. Actors: A Model of Concurrent Computation in Distributed Systems. MIT Press, Cambridge, MA.
[2]
Jonathan Aldrich, Joshua Sunshine, Darpan Saini, and Zachary Sparks. 2009. Typestate-oriented programming. In Proceedings of the 24th ACM SIGPLAN Conference Companion on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’09). ACM, New York, NY, 1015--1022.
[3]
Nels E. Beckman, Duri Kim, and Jonathan Aldrich. 2011. An empirical study of object protocols in the wild. In ECOOP 2011—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 6813. Springer, 2--26.
[4]
Nick Benton, Luca Cardelli, and Cédric Fournet. 2004. Modern concurrency abstractions for C#. ACM Transactions on Programming Languages and Systems 26, 5, 769--804.
[5]
Gérard Berry and Gérard Boudol. 1992. The chemical abstract machine. Theoretical Computer Science 96, 1, 217--248.
[6]
Kevin Bierhoff and Jonathan Aldrich. 2007. Modular typestate checking of aliased objects. In Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems and Applications (OOPSLA’07). ACM, New York, NY, 301--320.
[7]
Janusz A. Brzozowski. 1964. Derivatives of regular expressions. Journal of the ACM 11, 4, 481--494.
[8]
Peter Calvert and Alan Mycroft. 2012. Control flow analysis for the join calculus. In Static Analysis. Lecture Notes in Computer Science, Vol. 7460. Springer, 181--197.
[9]
Elias Castegren and Tobias Wrigstad. 2016. Reference capabilities for concurrency control. In Proceedings of 30th European Conference on Object-Oriented Programming (ECOOP’16). 5:1--5:26.
[10]
John Conway. 1971. Regular Algebra and Finite Machines. William Clowes 8 Sons Ltd, London, UK.
[11]
Mario Coppo, Mariangiola Dezani-Ciancaglini, Nobuko Yoshida, and Luca Padovani. 2016. Global progress for dynamically interleaved multiparty sessions. Mathematical Structures in Computer Science 26, 2, 238--302.
[12]
Bruno Courcelle. 1983. Fundamental properties of infinite trees. Theoretical Computer Science 25, 95--169.
[13]
Silvia Crafa and Luca Padovani. 2015. The chemical approach to typestate-oriented programming. ACM SIGPLAN Notices 50, 10, 917--934.
[14]
Silvia Crafa and Luca Padovani. 2017. CobaltBlue. Retrieved April 13, 2017, from http://www.di.unito.it/∼padovani/Software/CobaltBlue/index.html.
[15]
Ferruccio Damiani, Elena Giachino, Paola Giannini, and Sophia Drossopoulou. 2008. A type safe state abstraction for coordination in Java-like languages. Acta Informatica 45, 7--8, 479--536.
[16]
Ornela Dardha, Elena Giachino, and Davide Sangiorgi. 2012. Session types revisited. In Proceedings of the 14th Symposium on Principles and Practice of Declarative Programming (PPDP’12). ACM, New York, NY, 139--150.
[17]
Guido de Caso, Víctor A. Braberman, Diego Garbervetsky, and Sebastián Uchitel. 2013. Enabledness-based program abstractions for behavior validation. ACM Transactions on Software Engineering and Methodology 22, 3, 25:1--25:46.
[18]
Robert DeLine and Manuel Fähndrich. 2004. Typestates for objects. In ECOOP 2004—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 3086. Springer, 465--490.
[19]
Sophia Drossopoulou, Ferruccio Damiani, Mariangiola Dezani-Ciancaglini, and Paola Giannini. 2001. Fickle: Dynamic object re-classification. In ECOOP 2001—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 2072. Springer, 130--149.
[20]
Manuel Fähndrich and Robert DeLine. 2002. Adoption and focus: Practical linear types for imperative programming. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation (PLDI’02). ACM, New York, NY, 13--24.
[21]
Cédric Fournet and Georges Gonthier. 1996. The reflexive CHAM and the join-calculus. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’96). ACM, New York, NY, 372--385.
[22]
Cédric Fournet and Georges Gonthier. 2000. The join calculus: A language for distributed mobile programming. In Applied Semantics. Lecture Notes in Computer Science, Vol. 2395. Springer, 268--332.
[23]
Cédric Fournet, Cosimo Laneve, Luc Maranget, and Didier Rémy. 1997. Implicit typing à la ML for the join-calculus. In CONCUR’97: Concurrency Theory. Lecture Notes in Computer Science, Vol. 1243. Springer, 196--212.
[24]
Cédric Fournet, Cosimo Laneve, Luc Maranget, and Didier Rémy. 2003a. Inheritance in the join calculus. Journal of Logic and Algebraic Programming 57, 1--2, 23--69.
[25]
Cédric Fournet, Fabrice Le Fessant, Luc Maranget, and Alan Schmitt. 2003b. JoCaml: A language for concurrent distributed and mobile programming. In Advanced Functional Programming. Lecture Notes in Computer Science, Vol. 2638. Springer, 129--158.
[26]
Ronald Garcia, Éric Tanter, Roger Wolff, and Jonathan Aldrich. 2014. Foundations of typestate-oriented programming. ACM Transactions on Programming Languages and Systems 36, 4, 12.
[27]
Simon J. Gay and Vasco Thudichum Vasconcelos. 2010. Linear type theory for asynchronous session types. Journal of Functional Programming 20, 1, 19--50.
[28]
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 Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’10). ACM, New York, NY, 299--312.
[29]
Philipp Haller and Tom Van Cutsem. 2008. Implementing joins using extensible pattern matching. In COORDINATION 2008: Coordination Models and Languages. Lecture Notes in Computer Science, Vol. 5052. Springer, 135--152.
[30]
David Harel. 1987. Statecharts: A visual formalism for complex systems. Science of Computer Programming 8, 3, 231--274.
[31]
Thomas A. Henzinger, Ranjit Jhala, and Rupak Majumdar. 2005. Permissive interfaces. In Proceedings of the 10th European Software Engineering Conference Held Jointly with the 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering (ESEC/FSE’05). ACM, New York, NY, 31--40.
[32]
Carl Hewitt, Peter Bishop, and Richard Steiger. 1973. A universal modular ACTOR formalism for artificial intelligence. In Proceedings of the 3rd International Joint Conference on Artificial Intelligence (IJCAI’73). 235--245.
[33]
Kohei Honda. 1993. Types for dyadic interaction. In Proceedings of the 4th International Conference on Concurrency Theory (CONCUR’93). 509--523.
[34]
Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2016. Multiparty asynchronous session types. Journal of the ACM 63, 1, 9.
[35]
Raymond Hu and Nobuko Yoshida. 2016. Hybrid session verification through endpoint API generation. In Fundamental Approaches to Software Engineering. Lecture Notes in Computer Science, Vol. 9633. Springer, 401--418.
[36]
Hans Hüttel, Ivan Lanese, Vasco T. Vasconcelos, Luís Caires, Marco Carbone, Pierre-Malo Deniélou, Dimitris Mostrous, et al. 2016. Foundations of session types and behavioural contracts. ACM Computing Surveys 49, 1, 3:1--3:36.
[37]
G. Stewart Von Itzstein and Mark Jasiunas. 2003. On implementing high level concurrency in Java. In Advances in Computer Systems Architecture. Lecture Notes in Computer Science, Vol. 2823. Springer, 151--165.
[38]
Dongyun Jin, Patrick O’Neil Meredith, Dennis Griffith, and Grigore Roşu. 2011. Garbage collection for monitoring parametric properties. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11). ACM, New York, NY, 415--424.
[39]
Naoki Kobayashi, Benjamin C. Pierce, and David N. Turner. 1999. Linearity and the pi-calculus. ACM Transactions on Programming Languages and Systems 21, 5, 914--947.
[40]
Dimitrios Kouzapas, Ornela Dardha, Roly Perera, and Simon J. Gay. 2016. Typechecking protocols with Mungo and StMungo. In Proceedings of the 18th International Symposium on Principles and Practice of Declarative Programming (PPDP’16). ACM, New York, NY, 146--159.
[41]
Fabrice Le Fessant and Luc Maranget. 1998. Compiling join-patterns. Electronic Notes in Theoretical Computer Science 16, 3, 205--224.
[42]
Patrick O’Neil Meredith, Dongyun Jin, Feng Chen, and Grigore Roşu. 2010. Efficient monitoring of parametric context-free patterns. Automated Software Engineering 17, 2, 149--180.
[43]
Maged M. Michael and Michael L. Scott. 1996. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In Proceedings of the 15th Annual ACM Symposium on Principles of Distributed Computing (PODC’96). ACM, New York, NY, 267--275.
[44]
Microsoft Research. 2004. Comega. Retrieved April 13, 2017, from https://www.microsoft.com/en-us/research/project/comega/.
[45]
Elie Najm, Abdelkrim Nimour, and Jean-Bernard Stefani. 1999. Guaranteeing liveness in an object calculus through behavioural typing. In Proceedings of the Joint International Conference on Formal Description Techniques for Distributed Systems and Communication Protocols (FORTE’99) and Protocol Specification, Testing, and Verification (PSTV’99), Vol. 156. 203--221.
[46]
Piotr Nienaltowski. 2007. Practical Framework for Contract-Based Concurrent Object-Oriented Programming. Ph.D. Dissertation. ETH Zurich.
[47]
Oscar Nierstrasz. 1993. Regular types for active objects. In Proceedings of the 8th Annual Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’93). ACM, New York, NY, 1--15.
[48]
Luca Padovani. 2014. Deadlock and lock freedom in the linear π-calculus. In Proceedings of the Joint 23rd EACSL Annual Conference on Computer Science Logic and the 29th Annual ACM/IEEE Symposium on Logic in Computer Science (CSL-LICS’14). ACM, New York, NY, 72:1--72:10.
[49]
Marco Patrignani, Dave Clarke, and Davide Sangiorgi. 2011. Ownership types for the join calculus. In Formal Techniques for Distributed Systems. Lecture Notes in Computer Science, Vol. 6722. Springer, 289--303.
[50]
Hubert Plociniczak and Susan Eisenbach. 2010. JErlang: Erlang with joins. In COORDINATION 2010: Coordination Models and Languages. Lecture Notes in Computer Science, Vol. 6116. Springer, 61--75.
[51]
Franz Puntigam. 2001a. State inference for dynamically changing interfaces. Computer Languages 27, 4, 163--202.
[52]
Franz Puntigam. 2001b. Strong types for coordinating active objects. Concurrency and Computation: Practice and Experience 13, 4, 293--326.
[53]
Franz Puntigam and Christof Peter. 2001. Types for active objects with static deadlock prevention. Fundamenta Informaticae 48, 4, 315--341.
[54]
António Ravara and Vasco T. Vasconcelos. 2000. Typing non-uniform concurrent objects. In CONCUR 2000—Concurrency Theory. Lecture Notes in Computer Science, Vol. 1877. Springer, 474--489.
[55]
Claudio V. Russo. 2007. The joins concurrency library. In Practical Aspects of Declarative Languages. Lecture Notes in Computer Science, Vol. 4354. Springer, 260--274.
[56]
Claudio V. Russo. 2008. Join patterns for Visual Basic. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA’08). ACM, New York, NY, 53--72.
[57]
Davide Sangiorgi and David Walker. 2001. The Pi-Calculus: A Theory of Mobile Processes. Cambridge University Press, Cambridge, England.
[58]
Sven Stork, Paulo Marques, and Jonathan Aldrich. 2009. Concurrency by default: Using permissions to express dataflow in stateful programs. In Proceedings of the 24th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’09). ACM, New York, NY, 933--940.
[59]
Sven Stork, Karl Naden, Joshua Sunshine, Manuel Mohr, Alcides Fonseca, Paulo Marques, and Jonathan Aldrich. 2014. Æminium: A permission-based concurrent-by-default programming language approach. ACM Transactions on Programming Languages and Systems 36, 1, 2:1--2:42.
[60]
Robert E. Strom and Shaula Yemini. 1986. Typestate: A programming language concept for enhancing software reliability. IEEE Transactions on Software Engineering 12, 1, 157--171.
[61]
Joshua Sunshine, Karl Naden, Sven Stork, Jonathan Aldrich, and Éric Tanter. 2011. First-class state change in plaid. In Proceedings of the 26th ACM International Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’11). ACM, New York, NY, 713--732.
[62]
Aaron Joseph Turon and Claudio V. Russo. 2011. Scalable join patterns. In Proceedings of the 8th Annual Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’93). ACM, New York, NY, 575--594.
[63]
Philip Wadler. 2014. Propositions as sessions. Journal of Functional Programming 24, 2--3, 384--418.
[64]
Scott West, Sebastian Nanz, and Bertrand Meyer. 2015. Efficient and reasonable object-oriented concurrency. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’15). ACM, New York, NY, 273--274.

Cited By

View all
  • (2023)Special Delivery: Programming with Mailbox TypesProceedings of the ACM on Programming Languages10.1145/36078327:ICFP(78-107)Online publication date: 31-Aug-2023
  • (2021)Papaya: Global Typestate Analysis of Aliased ObjectsProceedings of the 23rd International Symposium on Principles and Practice of Declarative Programming10.1145/3479394.3479414(1-13)Online publication date: 6-Sep-2021
  • (2019)Concurrent Typestate-Oriented Programming in JavaElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.291.3291(24-34)Online publication date: 2-Apr-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 39, Issue 3
September 2017
196 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/3092741
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 26 May 2017
Accepted: 01 March 2017
Revised: 01 November 2016
Received: 01 March 2016
Published in TOPLAS Volume 39, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Typestate
  2. behavioral types
  3. concurrency
  4. join calculus

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • Ateneo/CSP Project SALT
  • MIUR PRIN CINA
  • University of Padova under the PRAT projects BECOM and ANCORE
  • ICT COST Action IC1201 BETTY
  • RS13MO12 DART

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)58
  • Downloads (Last 6 weeks)10
Reflects downloads up to 10 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Special Delivery: Programming with Mailbox TypesProceedings of the ACM on Programming Languages10.1145/36078327:ICFP(78-107)Online publication date: 31-Aug-2023
  • (2021)Papaya: Global Typestate Analysis of Aliased ObjectsProceedings of the 23rd International Symposium on Principles and Practice of Declarative Programming10.1145/3479394.3479414(1-13)Online publication date: 6-Sep-2021
  • (2019)Concurrent Typestate-Oriented Programming in JavaElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.291.3291(24-34)Online publication date: 2-Apr-2019
  • (2019)Resource Sharing via Capability-Based Multiparty Session TypesIntegrated Formal Methods10.1007/978-3-030-34968-4_24(437-455)Online publication date: 22-Nov-2019
  • (2018)A type checking algorithm for concurrent object protocolsJournal of Logical and Algebraic Methods in Programming10.1016/j.jlamp.2018.06.001100(16-35)Online publication date: Nov-2018
  • (2018)Stateful Behavioral Types for Active ObjectsIntegrated Formal Methods10.1007/978-3-319-98938-9_13(214-235)Online publication date: 9-Aug-2018

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media