Abstract
In type-and-coeffect systems, contexts are enriched by coeffects modeling how they are actually used, typically through annotations on single variables. Coeffects are computed bottom-up, combining, for each term, the coeffects of its subterms, through a fixed set of algebraic operators. We show that this principled approach can be adopted to track sharing in the imperative paradigm, that is, links among variables possibly introduced by the execution. This provides a significant example of non-structural coeffects, which cannot be computed by-variable, since the way a given variable is used can affect the coeffects of other variables. To illustrate the effectiveness of the approach, we enhance the type system tracking sharing to model a sophisticated set of features related to uniqueness and immutability. Thanks to the coeffect-based approach, we can express such features in a simple way and prove related properties with standard techniques.
- Andreas Abel and Jean-Philippe Bernardy. 2020. A unified view of modalities in type systems. Proceedings of ACM on Programming Languages, 4, ICFP (2020), 90:1–90:28. https://doi.org/10.1145/3408972
Google Scholar
Digital Library
- Paulo Sérgio Almeida. 1997. Balloon Types: Controlling Sharing of State in Data Types. In European Conference on Object-Oriented Programming, ECOOP 1997 (Lecture Notes in Computer Science, Vol. 1241). Springer, 32–59.
Google Scholar
- Robert Atkey. 2018. Syntax and Semantics of Quantitative Type Theory. In IEEE Symposium on Logic in Computer Science, LICS 2018, Anuj Dawar and Erich Grädel (Eds.). ACM Press, 56–65. https://doi.org/10.1145/3209108.3209189
Google Scholar
Digital Library
- Riccardo Bianchini, Francesco Dagnino, Paola Giannini, and Elena Zucca. 2022. A Java-like calculus with user-defined coeffects. In ICTCS’22 - Italian Conf. on Theoretical Computer Science. To appear
Google Scholar
- Riccardo Bianchini, Francesco Dagnino, Paola Giannini, Elena Zucca, and Marco Servetto. 2022. Coeffects for sharing and mutation. CoRR, abs/2209.07439 (2022), https://doi.org/10.48550/arXiv.2209.07439
Google Scholar
- John Boyland. 2010. Semantics of Fractional Permissions with Nesting. ACM Transactions on Programming Languages and Systems, 32, 6 (2010).
Google Scholar
Digital Library
- Flavien Breuvart and Michele Pagani. 2015. Modelling Coeffects in the Relational Semantics of Linear Logic. In 24th EACSL Annual Conference on Computer Science Logic, CSL 2015, Stephan Kreutzer (Ed.) (LIPIcs, Vol. 41). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 567–581. https://doi.org/10.4230/LIPIcs.CSL.2015.567
Google Scholar
Cross Ref
- Aloïs Brunel, Marco Gaboardi, Damiano Mazza, and Steve Zdancewic. 2014. A Core Quantitative Coeffect Calculus. In European Symposium on Programming, ESOP 2013, Zhong Shao (Ed.) (Lecture Notes in Computer Science, Vol. 8410). Springer, 351–370. https://doi.org/10.1007/978-3-642-54833-8_19
Google Scholar
Digital Library
- Elias Castegren and Tobias Wrigstad. 2016. Reference Capabilities for Concurrency Control. In European Conference on Object-Oriented Programming, ECOOP 2016, Shriram Krishnamurthi and Benjamin S. Lerner (Eds.) (LIPIcs, Vol. 56). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 5:1–5:26.
Google Scholar
- Pritam Choudhury, Harley Eades III, Richard A. Eisenberg, and Stephanie Weirich. 2021. A graded dependent type system with a usage-aware semantics. Proceedings of ACM on Programming Languages, 5, POPL (2021), 1–32. https://doi.org/10.1145/3434331
Google Scholar
Digital Library
- David Clarke and Tobias Wrigstad. 2003. External Uniqueness is Unique Enough. In European Conference on Object-Oriented Programming, ECOOP 2003, Luca Cardelli (Ed.) (Lecture Notes in Computer Science, Vol. 2473). Springer, 176–200.
Google Scholar
Cross Ref
- Sylvan Clebsch. 2017. ’Pony’: co-designing a type system and a runtime. Ph. D. Dissertation. Imperial College London, UK. https://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.769552
Google Scholar
- Sylvan Clebsch, Sophia Drossopoulou, Sebastian Blessing, and Andy McNeil. 2015. Deny capabilities for safe, fast actors. In International Workshop on Programming Based on Actors, Agents, and Decentralized Control, AGERE! 2015, Elisa Gonzalez Boix, Philipp Haller, Alessandro Ricci, and Carlos Varela (Eds.). ACM Press, 1–12.
Google Scholar
Digital Library
- Ugo Dal Lago and Francesco Gavazzo. 2022. A relational theory of effects and coeffects. Proceedings of ACM on Programming Languages, 6, POPL (2022), 1–28. https://doi.org/10.1145/3498692
Google Scholar
Digital Library
- Werner Dietl, Sophia Drossopoulou, and Peter Müller. 2007. Generic Universe Types. In European Conference on Object-Oriented Programming, ECOOP 2007, Erik Ernst (Ed.) (Lecture Notes in Computer Science, Vol. 4609). Springer, 28–53.
Google Scholar
- Marco Gaboardi, Shin-ya Katsumata, Dominic A. Orchard, Flavien Breuvart, and Tarmo Uustalu. 2016. Combining effects and coeffects via grading. In ACM International Conference on Functional Programming, ICFP 2016, Jacques Garrigue, Gabriele Keller, and Eijiro Sumii (Eds.). ACM Press, 476–489. https://doi.org/10.1145/2951913.2951939
Google Scholar
Digital Library
- Dan R. Ghica and Alex I. Smith. 2014. Bounded Linear Types in a Resource Semiring. In European Symposium on Programming, ESOP 2013, Zhong Shao (Ed.) (Lecture Notes in Computer Science, Vol. 8410). Springer, 331–350. https://doi.org/10.1007/978-3-642-54833-8_18
Google Scholar
Digital Library
- Paola Giannini, Tim Richter, Marco Servetto, and Elena Zucca. 2019. Tracing sharing in an imperative pure calculus. Science of Computer Programming, 172 (2019), 180–202. https://doi.org/10.1016/j.scico.2018.11.007 Extended version, CoRR.
Google Scholar
Cross Ref
- Paola Giannini, Marco Servetto, Elena Zucca, and James Cone. 2019. Flexible recovery of uniqueness and immutability. Theoretical Computer Science, 764 (2019), 145–172. https://doi.org/10.1016/j.tcs.2018.09.001 Extended version, CoRR.
Google Scholar
Digital Library
- Colin S. Gordon. 2020. Designing with Static Capabilities and Effects: Use, Mention, and Invariants (Pearl). In European Conference on Object-Oriented Programming, ECOOP 2020, Robert Hirschfeld and Tobias Pape (Eds.) (LIPIcs, Vol. 166). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 10:1–10:25. https://doi.org/10.4230/LIPIcs.ECOOP.2020.10
Google Scholar
Cross Ref
- Colin S. Gordon, Matthew J. Parkinson, Jared Parsons, Aleks Bromfield, and Joe Duffy. 2012. Uniqueness and reference immutability for safe parallelism. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 2012, Gary T. Leavens and Matthew B. Dwyer (Eds.). ACM Press, 21–40.
Google Scholar
Digital Library
- Philipp Haller and Martin Odersky. 2010. Capabilities for uniqueness and borrowing. In European Conference on Object-Oriented Programming, ECOOP 2010, Theo D’Hondt (Ed.) (Lecture Notes in Computer Science, Vol. 6183). Springer, 354–378.
Google Scholar
Cross Ref
- John Hogg. 1991. Islands: Aliasing Protection in Object-oriented Languages. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1991, Andreas Paepcke (Ed.). ACM Press, 271–285.
Google Scholar
- Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. 1999. Featherweight Java: A Minimal Core Calculus for Java and GJ. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1999. ACM Press, 132–146. https://doi.org/10.1145/320384.320395
Google Scholar
Digital Library
- Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. 2018. RustBelt: securing the foundations of the rust programming language. Proceedings of ACM on Programming Languages, 2, POPL (2018), 66:1–66:34. https://doi.org/10.1145/3158154
Google Scholar
Digital Library
- Daniel Marshall, Michael Vollmer, and Dominic Orchard. 2022. Linearity and Uniqueness: An Entente Cordiale. In European Symposium on Programming, ESOP 2022, Ilya Sergey (Ed.) (Lecture Notes in Computer Science, Vol. 13240). Springer, 346–375. https://doi.org/10.1007/978-3-030-99336-8_13
Google Scholar
Digital Library
- Conor McBride. 2016. I Got Plenty o’ Nuttin’. In A List of Successes That Can Change the World - Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday, Sam Lindley, Conor McBride, Philip W. Trinder, and Donald Sannella (Eds.) (Lecture Notes in Computer Science, Vol. 9600). Springer, 207–233. https://doi.org/10.1007/978-3-319-30936-1_12
Google Scholar
Cross Ref
- Mae Milano, Andrew C. Meyers, and Joshua Turcotti. 2022. A Flexible Type System for Fearless Concurrency. To appear
Google Scholar
- Peter Müller and Arsenii Rudich. 2007. Ownership transfer in universe types. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 2007, Richard P. Gabriel, David F. Bacon, Cristina Videira Lopes, and Guy L. Steele Jr. (Eds.). ACM Press, 461–478.
Google Scholar
Digital Library
- Dominic Orchard, Vilem-Benjamin Liepelt, and Harley Eades III. 2019. Quantitative program reasoning with graded modal types. Proceedings of ACM on Programming Languages, 3, ICFP (2019), 110:1–110:30. https://doi.org/10.1145/3341714
Google Scholar
Digital Library
- Tomas Petricek, Dominic A. Orchard, and Alan Mycroft. 2013. Coeffects: Unified Static Analysis of Context-Dependence. In Automata, Languages and Programming, ICALP 2013, Fedor V. Fomin, Rusins Freivalds, Marta Z. Kwiatkowska, and David Peleg (Eds.) (Lecture Notes in Computer Science, Vol. 7966). Springer, 385–397. https://doi.org/10.1007/978-3-642-39212-2_35
Google Scholar
Digital Library
- Tomas Petricek, Dominic A. Orchard, and Alan Mycroft. 2014. Coeffects: a calculus of context-dependent computation. In ACM International Conference on Functional Programming, ICFP 2014, Johan Jeuring and Manuel M. T. Chakravarty (Eds.). ACM Press, 123–135. https://doi.org/10.1145/2628136.2628160
Google Scholar
Digital Library
- Marco Servetto, David J. Pearce, Lindsay Groves, and Alex Potanin. 2013. Balloon Types for Safe Parallelisation over Arbitrary Object Graphs. In WODET 2014 - Workshop on Determinism and Correctness in Parallel Programming.
Google Scholar
- James Wood and Robert Atkey. 2022. A Framework for Substructural Type Systems. In European Symposium on Programming, ESOP 2022, Ilya Sergey (Ed.) (Lecture Notes in Computer Science, Vol. 13240). Springer, 376–402. https://doi.org/10.1007/978-3-030-99336-8_14
Google Scholar
Digital Library
Index Terms
Coeffects for sharing and mutation
Recommendations
A relational theory of effects and coeffects
Graded modal types systems and coeffects are becoming a standard formalism to deal with context-dependent, usage-sensitive computations, especially when combined with computational effects. From a semantic perspective, effectful and coeffectful ...
Combining effects and coeffects via grading
ICFP '16Effects and coeffects are two general, complementary aspects of program behaviour. They roughly correspond to computations which change the execution context (effects) versus computations which make demands on the context (coeffects). Effectful ...
Combining effects and coeffects via grading
ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional ProgrammingEffects and coeffects are two general, complementary aspects of program behaviour. They roughly correspond to computations which change the execution context (effects) versus computations which make demands on the context (coeffects). Effectful ...






Comments