TY - JOUR
T1 - Chaperones and impersonators
T2 - Run-time support for reasonable interposition
AU - Strickland, T. Stephen
AU - Tobin-Hochstadt, Sam
AU - Findler, Robert
AU - Flatt, Matthew
PY - 2012/10
Y1 - 2012/10
N2 - 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.
AB - 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.
KW - Contracts
KW - Intercession
KW - Interposition
KW - Proxies
UR - http://www.scopus.com/inward/record.url?scp=84870418057&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84870418057&partnerID=8YFLogxK
U2 - 10.1145/2398857.2384685
DO - 10.1145/2398857.2384685
M3 - Article
AN - SCOPUS:84870418057
SN - 1523-2867
VL - 47
SP - 943
EP - 961
JO - ACM SIGPLAN Notices
JF - ACM SIGPLAN Notices
IS - 10
ER -