Contracts as pairs of projections

  • Authors:
  • Robert Bruce Findler;Matthias Blume

  • Affiliations:
  • University of Chicago;Toyota Technological Institute at Chicago

  • Venue:
  • FLOPS'06 Proceedings of the 8th international conference on Functional and Logic Programming
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

Assertion-based contracts provide a powerful mechanism for stating invariants at module boundaries and for enforcing them uniformly. In 2002, Findler and Felleisen showed how to add contracts to higher-order functional languages, allowing programmers to assert invariants about functions as values. Following up in 2004, Blume and McAllester provided a quotient model for contracts. Roughly speaking, their model equates a contract with the set of values that cannot violate the contract. Their studies raised interesting questions about the nature of contracts and, in particular, the nature of the any contract. In this paper, we develop a model for software contracts that follows Dana Scott's program by interpreting contracts as projections. The model has already improved our implementation of contracts. We also demonstrate how it increases our understanding of contract-oriented programming and design. In particular, our work provides a definitive answer to the questions raised by Blume and McAllester's work. The key insight from our model that resolves those questions is that a contract that puts no obligation on either party is not the same as the most permissive contract for just one of the parties.