Reachability types: tracking aliasing and separation in higher-order functional programs

Ownership type systems, based on the idea of enforcing unique access paths, have been primarily focused on objects and top-level classes. However, existing models do not as readily reflect the finer aspects of nested lexical scopes, capturing, or escaping closures in higher-order functional programming patterns, which are increasingly adopted even in mainstream object-oriented languages. We present a new type system, λ* , which enables expressive ownership-style reasoning across higher-order functions. It tracks sharing and separation through reachability sets, and layers additional mechanisms for selectively enforcing uniqueness on top of it. Based on reachability sets, we extend the type system with an expressive flow-sensitive effect system, which enables flavors of move semantics and ownership transfer. In addition, we present several case studies and extensions, including applications to capabilities for algebraic effects, one-shot continuations, and safe parallelization.

[1]  Martin Odersky,et al.  Tracking Captured Variables in Types , 2021, ArXiv.

[2]  Anil Madhavapeddy,et al.  Retrofitting effect handlers onto OCaml , 2021, PLDI.

[3]  Derek Dreyer,et al.  Safe systems programming in Rust , 2021, Commun. ACM.

[4]  Colin S. Gordon Polymorphic Iterable Sequential Effect Systems , 2018, ArXiv.

[5]  OstermannKlaus,et al.  Effects as capabilities: effect handlers and lightweight effect polymorphism , 2020 .

[6]  Ifaz Kabir,et al.  ιDOT: a DOT calculus with object initialization , 2020, Proc. ACM Program. Lang..

[7]  Compiling effect handlers in capability-passing style , 2020, Proc. ACM Program. Lang..

[8]  Effect handlers, evidently , 2020, Proc. ACM Program. Lang..

[9]  ARTHUR CHARGUÉRAUD,et al.  Separation logic for sequential programs (functional pearl) , 2020, Proc. ACM Program. Lang..

[10]  Colin S. Gordon Designing with Static Capabilities and Effects: Use, Mention, and Invariants , 2020, ECOOP.

[11]  Alan Mycroft,et al.  Data-Flow Analyses as Effects and Graded Monads , 2020, FSCD.

[12]  Klaus Ostermann,et al.  Effekt: Capability-passing style for type- and effect-safe, extensible effect handlers in Scala , 2020, J. Funct. Program..

[13]  DANIEL HILLERSTRÖM,et al.  Effect handlers via generalised continuations , 2020, J. Funct. Program..

[14]  Fengyun Liu,et al.  A type-and-effect system for object initialization , 2020, Proc. ACM Program. Lang..

[15]  Binders by day, labels by night: effect instances via lexically scoped handlers , 2019, Proc. ACM Program. Lang..

[16]  Colin S. Gordon Lifting Sequential Effects to Control Operators , 2020, ECOOP.

[17]  Tiark Rompf,et al.  Compiling with continuations, or without? whatever. , 2019, Proc. ACM Program. Lang..

[18]  Dariusz Biernacki,et al.  Abstracting algebraic effects , 2019, Proc. ACM Program. Lang..

[19]  Andrew C. Myers,et al.  Abstraction-safe effect handlers via tunneling , 2019, Proc. ACM Program. Lang..

[20]  Sam Lindley,et al.  Shallow Effect Handlers , 2018, APLAS.

[21]  Derek Dreyer,et al.  RustBelt: securing the foundations of the rust programming language , 2017, Proc. ACM Program. Lang..

[22]  Simon L. Peyton Jones,et al.  Linear Haskell: practical linearity in a higher-order polymorphic language , 2017, Proc. ACM Program. Lang..

[23]  Lars Birkedal,et al.  Iris from the ground up: A modular foundation for higher-order concurrent separation logic , 2018, Journal of Functional Programming.

[24]  Robert Atkey,et al.  Continuation Passing Style for Effect Handlers , 2017, FSCD.

[25]  Lars Birkedal,et al.  The Essence of Higher-Order Concurrent Separation Logic , 2017, ESOP.

[26]  Nada Amin,et al.  Type soundness proofs with definitional interpreters , 2017, POPL.

[27]  Daan Leijen,et al.  Type directed compilation of row-typed algebraic effects , 2017, POPL.

[28]  Tiark Rompf,et al.  Gentrification gone too far? affordable 2nd-class values for fun and (co-)effect , 2016, OOPSLA.

[29]  Philipp Haller,et al.  LaCasa: lightweight affinity and object capabilities in Scala , 2016, OOPSLA.

[30]  Nada Amin,et al.  Type soundness for dependent object types (DOT) , 2016, OOPSLA.

[31]  Martin Odersky,et al.  The Essence of Dependent Object Types , 2016, A List of Successes That Can Change the World.

[32]  Elias Castegren,et al.  Reference Capabilities for Concurrency Control , 2016, ECOOP.

[33]  Sophia Drossopoulou,et al.  Deny capabilities for safe, fast actors , 2015, AGERE!@SPLASH.

[34]  Kunle Olukotun,et al.  Go Meta! A Case for Generative Programming and DSLs in Performance Critical Systems , 2015, SNAPL.

[35]  S. Drossopoulou,et al.  Ownership and Reference Counting based Garbage Collection in the Actor World , 2015 .

[36]  Bertrand Meyer,et al.  Alias calculus, change calculus and frame inference , 2015, Sci. Comput. Program..

[37]  Martin Odersky,et al.  Unifying functional and object-oriented programming with Scala , 2014, Commun. ACM.

[38]  Nicholas D. Matsakis,et al.  The rust language , 2014, HILT '14.

[39]  Gabriel Scherer,et al.  Tracking Data-Flow with Open Closure Types , 2013, LPAR.

[40]  Ohad Kammar,et al.  Handlers in action , 2013, ICFP.

[41]  Kunle Olukotun,et al.  Optimizing data structures in high-level programs: new directions for extensible compilers based on staging , 2013, POPL.

[42]  Dave Clarke,et al.  Ownership Types: A Survey , 2013, Aliasing in Object-Oriented Programming.

[43]  Martin Odersky,et al.  Lightweight modular staging , 2012, Commun. ACM.

[44]  Michael D. Ernst,et al.  Static lock capabilities for deadlock freedom , 2012, TLDI '12.

[45]  Jonathan Aldrich,et al.  A type system for borrowing permissions , 2012, POPL '12.

[46]  Sophia Drossopoulou,et al.  Separating ownership topology and encapsulation with generic universe types , 2011, TOPL.

[47]  Peter Müller,et al.  Freedom before commitment: a lightweight type system for object initialisation , 2011, OOPSLA '11.

[48]  David J. Pearce JPure: A Modular Purity System for Java , 2011, CC.

[49]  Martin Odersky,et al.  Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs , 2010, GPCE '10.

[50]  Martin Odersky,et al.  Capabilities for Uniqueness and Borrowing , 2010, ECOOP.

[51]  Olin Shivers,et al.  CFA2: A Context-Free Approach to Control-Flow Analysis , 2010, ESOP.

[52]  Jonathan Aldrich,et al.  Typestate-oriented programming , 2009, OOPSLA Companion.

[53]  Martin Odersky,et al.  Implementing first-class polymorphic delimited continuations by a type-directed selective CPS-transform , 2009, ICFP.

[54]  Hirotoshi Yasuoka,et al.  Polymorphic Fractional Capabilities , 2009, SAS.

[55]  Gordon D. Plotkin,et al.  Handlers of Algebraic Effects , 2009, ESOP.

[56]  Lars Birkedal,et al.  Design patterns in separation logic , 2009, TLDI '09.

[57]  Einar Broch Johnsen,et al.  Minimal Ownership for Active Objects , 2008, APLAS.

[58]  Jan Vitek,et al.  Implicit ownership types for memory management , 2008, Sci. Comput. Program..

[59]  Martín Abadi,et al.  Semantics of transactional memory and automatic mutual exclusion , 2008, POPL '08.

[60]  Marinus J. Plasmeijer,et al.  Uniqueness Typing Simplified , 2008, IFL.

[61]  Marinus J. Plasmeijer,et al.  Uniqueness Typing Redefined , 2006, IFL.

[62]  J. Gregory Morrisett,et al.  L3: A Linear Language with Locations , 2007, Fundam. Informaticae.

[63]  Yi Lu,et al.  A Type System for Reachability and Acyclicity , 2005, ECOOP.

[64]  John C. Reynolds,et al.  Separation Logic for a Higher-Order Typed Language , 2005 .

[65]  Peter W. O'Hearn On bunched typing , 2003, J. Funct. Program..

[66]  John Tang Boyland,et al.  Checking Interference with Fractional Permissions , 2003, SAS.

[67]  Alexander Aiken,et al.  Checking and inferring local non-aliasing , 2003, PLDI '03.

[68]  Gordon D. Plotkin,et al.  Algebraic Operations and Generic Effects , 2003, Appl. Categorical Struct..

[69]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[70]  Sophia Drossopoulou,et al.  Ownership, encapsulation and the disjointness of type and effect , 2002, OOPSLA '02.

[71]  John C. Reynolds,et al.  Separation logic: a logic for shared mutable data structures , 2002, Proceedings 17th Annual IEEE Symposium on Logic in Computer Science.

[72]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[73]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[74]  Peter W. O'Hearn,et al.  Local Reasoning about Programs that Alter Data Structures , 2001, CSL.

[75]  Robert DeLine,et al.  Enforcing high-level protocols in low-level software , 2001, PLDI '01.

[76]  James Noble,et al.  Simple Ownership Types for Object Containment , 2001, ECOOP.

[77]  John Tang Boyland,et al.  Capabilities for Sharing: A Generalisation of Uniqueness and Read-Only , 2001, ECOOP.

[78]  Peter W. O'Hearn,et al.  BI as an assertion language for mutable data structures , 2001, POPL '01.

[79]  David Walker,et al.  Typed memory management via static capabilities , 2000, TOPL.

[80]  David Walker,et al.  Alias Types , 2000, ESOP.

[81]  Peter W. O'Hearn,et al.  Syntactic Control of Interference Revisited , 1999, Theor. Comput. Sci..

[82]  F. Nielson,et al.  The Type and Effect System , 1999 .

[83]  Peter M Uller,et al.  Universes: a type system for controlling representation exposure , 1999 .

[84]  Flemming Nielson,et al.  Type and Effect Systems , 1999, Correct System Design.

[85]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[86]  Jan Vitek,et al.  Flexible Alias Protection , 1998, ECOOP.

[87]  David Gay,et al.  Memory management with explicit regions , 1998, PLDI.

[88]  Thomas W. Reps,et al.  Program analysis via graph reachability , 1997, Inf. Softw. Technol..

[89]  Mads Tofte,et al.  Region-based Memory Management , 1997, Inf. Comput..

[90]  R. Kent Dybvig,et al.  Representing control in the presence of one-shot continuations , 1996, PLDI '96.

[91]  E. R I K B A R En D S E N,et al.  Uniqueness Typing for Functional Languages with Graph Rewriting Semantics , 1996 .

[92]  Philip Wadler,et al.  Once upon a type , 1995, FPCA '95.

[93]  Thomas W. Reps,et al.  Precise interprocedural dataflow analysis via graph reachability , 1995, POPL '95.

[94]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[95]  Robert Harper,et al.  Typing first-class continuations in ML , 1991, POPL '91.

[96]  Martin Odersky,et al.  How to make destructive updates less destructive , 1991, POPL '91.

[97]  John Hogg,et al.  Islands: aliasing protection in object-oriented languages , 1991, OOPSLA '91.

[98]  Luca Cardelli,et al.  An Extension of System F with Subtyping , 1991, TACS.

[99]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[100]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[101]  John C. Reynolds,et al.  Syntactic Control of Inference, Part 2 , 1989, ICALP.

[102]  Olivier Danvy,et al.  A Functional Abstraction of Typed Contexts , 1989 .

[103]  David K. Gifford,et al.  Polymorphic effect systems , 1988, POPL '88.

[104]  Matthias Felleisen,et al.  The theory and practice of first-class prompts , 1988, POPL '88.

[105]  David K. Gifford,et al.  Integrating functional and imperative programming , 1986, LFP '86.

[106]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[107]  John C. Reynolds,et al.  Syntactic control of interference , 1978, POPL.

[108]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[109]  J. Girard Une Extension De ĽInterpretation De Gödel a ĽAnalyse, Et Son Application a ĽElimination Des Coupures Dans ĽAnalyse Et La Theorie Des Types , 1971 .