Chaperones and impersonators: Run-time support for reasonable interposition

T. Stephen Strickland*, Sam Tobin-Hochstadt, Robert Findler, Matthew Flatt

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

6 Scopus citations

Abstract

Chaperones and impersonators provide run-time support for interposing on primitive operations such as function calls, array access and update, and structure field access and update. Unlike most interposition support, chaperones and impersonators are restricted so that they constrain the behavior of the interposing code to reasonable interposition, which in practice preserves the abstraction mechanisms and reasoning that programmers and compiler analyses rely on. Chaperones and impersonators are particularly useful for implementing contracts, and our implementation in Racket allows us to improve both the expressiveness and the performance of Racket's contract system. Specifically, contracts on mutable data can be enforced without changing the API to that data; contracts on large data structures can be checked lazily on only the accessed parts of the structure; contracts on objects and classes can be implemented with lower overhead; and contract wrappers can preserve object equality where appropriate. With this extension, gradual typing systems, such as Typed Racket, that rely on contracts for interoperation with untyped code can now pass mutable values safely between typed and untyped modules.

Original languageEnglish (US)
Pages (from-to)943-961
Number of pages19
JournalACM SIGPLAN Notices
Volume47
Issue number10
DOIs
StatePublished - Oct 1 2012

Keywords

  • Contracts
  • Intercession
  • Interposition
  • Proxies

ASJC Scopus subject areas

  • Computer Science(all)

Fingerprint Dive into the research topics of 'Chaperones and impersonators: Run-time support for reasonable interposition'. Together they form a unique fingerprint.

Cite this