ACM Home Page
Please provide us with feedback. Feedback
Digital Library logoTake a look at the new version of this page: [ beta version ]. Tell us what you think.
Contracts made manifest
Full text PdfPdf (501 KB)
Source
Annual Symposium on Principles of Programming Languages archive
Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages table of contents
Madrid, Spain
SESSION: Relating and integrating static and dynamic checks table of contents
Pages: 353-364  
Year of Publication: 2010
ISBN:978-1-60558-479-9
Also published in ...
Authors
Michael Greenberg  University of Pennsylvania, Philadelphia, PA, USA
Benjamin C. Pierce  University of Pennsylvania, Philadelphia, PA, USA
Stephanie Weirich  University of Pennsylvania, Philadelphia, PA, USA
Sponsors
SIGACT: ACM Special Interest Group on Algorithms and Computation Theory
SIGPLAN: ACM Special Interest Group on Programming Languages
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 46,   Downloads (12 Months): 46,   Citation Count: 0
Additional Information:

abstract   references   index terms  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1706299.1706341
What is a DOI?

ABSTRACT

Since Findler and Felleisen introduced higher-order contracts , many variants have been proposed. Broadly, these fall into two groups: some follow Findler and Felleisen in using latent contracts, purely dynamic checks that are transparent to the type system; others use manifest contracts, where refinement types record the most recent check that has been applied to each value. These two approaches are commonly assumed to be equivalent---different ways of implementing the same idea, one retaining a simple type system, and the other providing more static information. Our goal is to formalize and clarify this folklore understanding.

Our work extends that of Gronski and Flanagan, who defined a latent calculus λ C and a manifest calculus λ H , gave a translation φ from λ C to λ H , and proved that, if a λ C term reduces to a constant, then so does its φ-image. We enrich their account with a translation Ψ from λ H to λ C and prove an analogous theorem.

We then generalize the whole framework to dependent contracts , whose predicates can mention free variables. This extension is both pragmatically crucial, supporting a much more interesting range of contracts, and theoretically challenging. We define dependent versions of λ H and two dialects ("lax" and "picky") of λ C , establish type soundness---a substantial result in itself, for λ H ---and extend φ and Ψ accordingly. Surprisingly, the intuition that the latent and manifest systems are equivalent now breaks down: the extended translations preserve behavior in one direction but, in the other, sometimes yield terms that blame more.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
 
2
Olaf Chitil and Frank Huch. Monadic, prompt lazy assertions in haskell. In APLAS, pages 38--53, 2007.
 
3
Robert Bruce Findler. Contracts as pairs of projections. In Symposium on Logic Programming, pages 226--241, 2006.
4
5
 
6
Jessica Gronski and Cormac Flanagan. Unifying hybrid types and contracts. In Trends in Functional Programming (TFP), 2007.
 
7
Jessica Gronski, Kenneth Knowles, Aaron Tomb, Stephen N. Freund, and Cormac Flanagan. Sage: Hybrid checking for flexible specifications. In Scheme and Functional Programming Workshop, pages 93--104, 2006.
8
 
9
Ralf Hinze, Johan Jeuring, and Andres L¨oh. Typed contracts for functional programming. In Functional and Logic Programming (FLOPS), pages 208--225, 2006.
 
10
Kenneth Knowles and Cormac Flanagan. Hybrid type checking. To appear in TOPLAS., 2009.
 
11
 
12
Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and DavidWalker. Dynamic typing with dependent types. In IFIP TCS, pages 437--450, 2004.
13
 
14
Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Workshop on Scheme and Functional Programming, 2007.
 
15
16