Chaperones and impersonators: run-time support for reasonable interposition

TS Strickland, S Tobin-Hochstadt, RB Findler… - ACM SIGPLAN …, 2012 - dl.acm.org
ACM SIGPLAN Notices, 2012dl.acm.org
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 …
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.
ACM Digital Library
Showing the best result for this search. See all results