Another Type System for In-Place Update

Linear typing schemes guarantee single-threadedness and so the soundness of in-place update with respect to a functional semantics. But linear schemes are restrictive in practice, and more restrictive than necessary to guarantee soundness of in-place update. This has prompted research into static analysis and more sophisticated typing disciplines, to determine when in-place update may be safely used, or to combine linear and non-linear schemes. Here we contribute to this line of research by defining a new typing scheme which better approximates the semantic property of soundness of in-place update for a functional semantics. Our typing scheme includes two kinds of products (? and ×), which allows data structures with or without sharing to be defined. We begin from the observation that some data is used only in a "read-only" context after which it may be safely re-used before being destroyed. Formalizing the in-place update interpretation and giving a machine model semantics allows us to refine this observation. We define three usage aspects apparent from the semantics, which are used to annotate function argument types. The aspects are (1) used destructively, (2) used read-only but shared with result, and (3) used read-only and not shared.

[1]  Naoki Kobayashi Quasi-linear types , 1999, POPL '99.

[2]  Simon Peyton Jones,et al.  Simple Usage Polymorphism , 2000 .

[3]  Reinhard Wilhelm,et al.  Shape Analysis , 2000, CC.

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

[5]  M. Hofmann A Type System for Bounded Space and Functional In-Place Update , 2000, Nord. J. Comput..

[6]  Martin Odersky Observers for Linear Types , 1992, ESOP.

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

[8]  Mitchell Wand,et al.  Set constraints for destructive array update optimization , 2001, J. Funct. Program..

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

[10]  John C. Reynolds,et al.  Intuitionistic reasoning about shared mutable data structure , 1999 .

[11]  Erik Barendsen,et al.  Uniqueness Typing for Functional Languages with Graph Rewriting Semantics , 1996, Math. Struct. Comput. Sci..

[12]  David Walker,et al.  Typed memory management in a calculus of capabilities , 1999, POPL '99.

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

[14]  Peter W. O'Hearn,et al.  The Logic of Bunched Implications , 1999, Bulletin of Symbolic Logic.

[15]  Martin Hofmann,et al.  The strength of non-size increasing computation , 2002, POPL '02.

[16]  Martin Hofmann,et al.  Linear types and non-size-increasing polynomial time computation , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[17]  David Aspinall,et al.  Heap-Bounded Assembly Language , 2004, Journal of Automated Reasoning.

[18]  H. Reddy,et al.  Imperative Lambda Calculus Revisited , 1997 .

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

[20]  S. Purushothaman Iyer,et al.  A Uniform Treatment of Order of Evalaution and Aggregate Update , 1993, Theor. Comput. Sci..

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