Contracts for first-class classes

T. Stephen Strickland, Christos Dimoulas, Asumu Takikawa, Matthias Felleisen

Research output: Contribution to journalArticlepeer-review

9 Scopus citations

Abstract

First-class classes enable programmers to abstract over patterns in the class hierarchy and to experiment with new forms of object-oriented programming such as mixins and traits. This increase in expressive power calls for tools to control the complexity of the software architecture. A contract system is one possible tool that has seen much use in object-oriented programming languages, but existing contract systems cannot cope with first-class classes. On the one hand, the typical contract language deals only with plain values such as numbers, while classes are higher-order values. On the other hand, contract specifications are usually contained within class definitions, while classes as values call for a separate contract language. This article presents the design and implementation of a contract system for first-class classes as well as a two-pronged evaluation. The first one states and proves a blame correctness theorem for a model of our language. The theorem shows that when the contract system assigns blame to a component for a contract violation, the component is indeed responsible for providing the nonconforming value. The second part, consisting of benchmarks and case studies, demonstrates the need for the rich contract language and validates that our implementation approach is performant with respect to time.

Original languageEnglish (US)
Article number11
JournalACM Transactions on Programming Languages and Systems
Volume35
Issue number3
DOIs
StatePublished - Nov 1 2013

Keywords

  • Contracts
  • First-class class systems

ASJC Scopus subject areas

  • Software

Fingerprint Dive into the research topics of 'Contracts for first-class classes'. Together they form a unique fingerprint.

Cite this