A generic type-and-effect system

Type-and-effect systems are a natural approach for statically reasoning about a program's execution. They have been used to track a variety of computational effects, for example memory manipulation, exceptions, and locking. However, each type-and-effect system is typically implemented as its own monolithic type system that hard-codes a particular syntax of effects along with particular rules to track and control those effects. We present a generic type-and-effect system, which is parameterized by the syntax of effects to track and by two functions that together specify the effect discipline to be statically enforced. We describe how a standard form of type soundness is ensured by requiring these two functions to obey a few natural monotonicity requirements. We demonstrate that several effect systems from the literature can be viewed as instantiations of our generic type system. Finally, we describe the implementation of our type-and-effect system and mechanically checked type soundness proof in the Twelf proof assistant.

[1]  Nick Benton,et al.  Reading, Writing and Relations Towards Extensional Semantics for Effect Analyses , 2006 .

[2]  Mads Tofte,et al.  Implementation of the typed call-by-value λ-calculus using a stack of regions , 1994, POPL '94.

[3]  Rupak Majumdar,et al.  Tasks: language support for event-driven programming , 2007, PEPM '07.

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

[5]  Jens Palsberg,et al.  Trust in the λ-calculus , 1995, Journal of Functional Programming.

[6]  Alexander Aiken,et al.  Flow-sensitive type qualifiers , 2002, PLDI '02.

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

[8]  Jens Palsberg,et al.  Inference of User-Defined Type Qualifiers and Qualifier Rules , 2006, ESOP.

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

[10]  Shane Markstrum,et al.  Semantic type qualifiers , 2005, PLDI '05.

[11]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[12]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[13]  Michael Hicks,et al.  Contextual effects for version-consistent dynamic software updating and safe concurrent programming , 2008, POPL '08.

[14]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[15]  Milo M. K. Martin,et al.  Subtleties of transactional memory atomicity semantics , 2006, IEEE Computer Architecture Letters.

[16]  Andrzej Filinski,et al.  Representing layered monads , 1999, POPL '99.

[17]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[18]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[19]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[20]  Aleksandar Nanevski A Modal Calculus for Exception Handling , 2005 .

[21]  Robert J. Simmons Twelf as a unified framework for language formalization and implementation , 2005 .

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

[23]  Alexander Aiken,et al.  A theory of type qualifiers , 1999, PLDI '99.

[24]  Nick Benton,et al.  Semantics of an effect analysis for exceptions , 2007, TLDI '07.

[25]  Michael Isard,et al.  Automatic Mutual Exclusion , 2007, HotOS.

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

[27]  Aleksandar Nanevski,et al.  From dynamic binding to state via modal possibility , 2003, PPDP '03.

[28]  Jeffrey S. Foster,et al.  Flow-insensitive type qualifiers , 2006, TOPL.

[29]  David Walker,et al.  An effective theory of type refinements , 2003, ACM SIGPLAN Notices.

[30]  Martín Abadi,et al.  Types for safe locking: Static race detection for Java , 2006, TOPL.

[31]  Furio Honsell,et al.  A framework for defining logics , 1993, JACM.

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

[33]  Microsystems Sun,et al.  Enterprise JavaBeans^ Specification Version 2.1 , 2002 .

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

[35]  David A. Wagner,et al.  This copyright notice must be included in the reproduced paper. USENIX acknowledges all trademarks herein. Detecting Format String Vulnerabilities with Type Qualifiers , 2001 .

[36]  Pierre Jouvelot,et al.  Report on the FX-91 Programming Language , 1992 .