The Type and Effect Discipline

Abstract The type and effect discipline is a new framework for reconstructing the principal type and the minimal effect of expressions in implicitly typed polymorphic functional languages that support imperative constructs. The type and effect discipline outperforms other polymorphic type systems. Just as types abstract collections of concrete values, effects denote imperative operations on regions. Regions abstract sets of possibly aliased memory locations. Effects are used to control type generalization in the presence of imperative constructs while regions delimit observable side-effects. The observable effects of an expression range over the regions that are free in its type environment and its type; effects related to local data structures can be discarded during type reconstruction. The type of an expression can be generalized with respect to the type variables that are not free in the type environment or in the observable effect. Introducing the type and effect discipline, we define both a dynamic and a static semantics for an ML-like language and prove that they are consistently related. We present a reconstruction algorithm that computes the principal type and the minimal observable effect of expressions. We prove its correctness with respect to the static semantics.

[1]  Xavier Leroy,et al.  Polymorphic type inference and assignment , 1991, POPL '91.

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

[3]  Luís Damas Type assignment in programming languages , 1984 .

[4]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[5]  Xavier Leroy,et al.  The ZINC experiment : an economical implementation of the ML language , 1990 .

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

[7]  Paul Gochet,et al.  The Syntactic Approach , 1980 .

[8]  N. S. Barnett,et al.  Private communication , 1969 .

[9]  Robin Milner,et al.  Co-Induction in Relational Semantics , 1991, Theor. Comput. Sci..

[10]  Pierre Jouvelot,et al.  Reasoning about continuations with control effects , 1989, PLDI '89.

[11]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.

[12]  Pierre Jouvelot,et al.  Polymorphic type, region and effect inference , 1992, Journal of Functional Programming.

[13]  Joannes M. Lucassen Types and Effects Towards the Integration of Functional and Imperative Programming. , 1987 .

[14]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[15]  Mark Lillibridge,et al.  Polymorphic type assignment and CPS conversion , 1993, LISP Symb. Comput..

[16]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[17]  Pierre Jouvelot,et al.  Algebraic reconstruction of types and effects , 1991, POPL '91.

[18]  Matthias Felleisen,et al.  A Syntactic Theory of Sequential State , 1989, Theor. Comput. Sci..

[19]  James W. O'Toole Type Abstraction Rules for References: A Comparison of Four which have Achieved Notoriety , 1991 .

[20]  X. Leroy Typage polymorphe d'un langage algorithmique , 1992 .