skip to main content
research-article

Chaperones and impersonators: run-time support for reasonable interposition

Published:19 October 2012Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

References

  1. Jonathan Aldrich. Open Modules: Modular Reasoning About Ad-vice. In Proc. European Conf. Object-Oriented Programming, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Thomas H. Austin, Tim Disney, and Cormac Flanagan. Virtual Values for Language Extension. In Proc. ACM Conf. Object-Oriented Programming, Systems, Languages and Applications, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Stephanie Balzer, Patrick Eugster, and Bertrand Meyer. Can Aspects Implement Contracts? In Proc. Rapid Implemetation of Software Engineering Techniques, pp. 145--157, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Olaf Chitil. Practical Typed Lazy Contracts. In Proc. ACM Intl. Conf. Functional Programming, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Olaf Chitil and Frank Huch. A pattern logic for prompt lazy asser-tions. In Proc. Intl. Sym. Functional and Logic Programming, pp. 126--144, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Olaf Chitil, Dan McNeill, and Colin Runciman. Lazy Assertions. In Proc. Intl. Sym. Functional and Logic Programming, 2003.Google ScholarGoogle Scholar
  7. Curtis Clifton and Gary T. Leavens. Observers and assistants: A proposal for modular aspect-oriented reasoning. In Proc. Foundations of Aspect-Oriented Languages, 2002.Google ScholarGoogle Scholar
  8. Daniel S. Dantas and David Walker. Harmless Advice. In Proc. ACM Sym. Principles of Programming Languages, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Jessie Dedecker, Tom Van Cutsem, Stijn Mostinckx, Theo D'Hondt, and Wolfgang De Meuter. Ambient-Oriented Programming. In Proc. ACM Conf. Object-Oriented Programming, Systems, Languages and Applications, pp. 31--40, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Digital Mars. D Programming Language. 1999. http://www.digitalmars.com/d/Google ScholarGoogle Scholar
  11. Tim Disney. Contracts.coffee. 2012. http://disnetdev.com/contracts.coffee/Google ScholarGoogle Scholar
  12. James E. Donnelley. A distributed capability computing system. In Proc. Intl. Conf. on Computer Communication, 1976.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Pedro Felzenszwalb and David McAllester. A min-cover approach for finding salient curves. In Proc. IEEE Wksp. Perceptual Organization in Computer Vision, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robert Bruce Findler andMatthias Felleisen. Contracts for Higher-Order Functions. In Proc. ACM Intl. Conf. Functional Programming, pp. 48--59, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Robert Bruce Findler, Shu-yu Guo, and Anne Rogers. Lazy Contract Checking for Immutable Data Structures. In Proc. Implementation and Application of Functional Languages, 2007.Google ScholarGoogle Scholar
  16. Matthew Flatt and PLT. Reference: Racket. PLT Inc., PLT-TR-2010-1, 2010. http://racket-lang.org/tr1/Google ScholarGoogle Scholar
  17. Brian Hackett and Shu-Yu Guo. Fast and precise type inference for JavaScript. In Proc. Conf. on Programming Language Design and Implementation, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ralf Hinze, Johan Jeuring, and Andres Löh. Typed Contracts for Functional Programming. In Proc. Sym. Functional and Logic Programming, pp. 208--225, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-Oriented Programming. In Proc. European Conf. Object-Oriented Programming, pp. 220--242, 1997.Google ScholarGoogle Scholar
  20. Gregor J. Kiczales, James des Rivieres, and Daniel G. Bobrow. The Art of the Metaobject Protocol. MIT Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. B. W. Lampson, J. J. Horning, R. L. London, J. G. Mitchell, and G. J. Popek. Report on the programming language Euclid. ACM SIGPLAN Notices 12(2), pp. 1--79, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. D. C. Luckham and F. W. von Henke. An overview of Anna, a specification language for Ada. IEEE Software 2(2), pp. 9--22, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Jacob Matthews and Amal Ahmed. Parametric Polymorphism Through Run-Time Sealing, or, Theorems for Low, Low Prices! In Proc. European Sym. on Programming, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. E. Mera, P. Lopez-Garcia, and M. Hermenegildo. Integrating Software Testing and Run-Time Checking in an Assertion Verification Framework. In Proc. Intl. Conf. on Logic Programming, LNCS 5649, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Bertrand Meyer. Eiffel : The Language. Prentice Hall PTR, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Mark S. Miller. Robust Composition: Towards a Unified Approach to Access Control and Concurrency Control. PhD dissertation, John Hopkins University, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Stijn Mostinckx, Tom Van Cutsem, Elisa Gonzalez Boix, Stijn Timbermont, Éric Tanter, and Wolfgang De Meuter. Mirror-based reflection in AmbientTalk. Software-Practice and Experience 39, pp. 661--699, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Toby Murray. Analysing the Security Properties of Object-Capability Patterns. PhD dissertation, Hertford College, Oxford University, 2010.Google ScholarGoogle Scholar
  29. Bruno C. d. S. Oliveira, Tom Schrijvers, and William R. Cook. Effective Advice: Disciplined Advice with Explicit Effects. In Proc. Aspect-Oriented Software Development, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Oracle. java.lang.reflect.Proxy. 2000. http://download.oracle.com/javase/6/docs/api/java/lang/reflect/Proxy.htmlGoogle ScholarGoogle Scholar
  31. Susan A. Rajunas. The KeyKOS/KeySAFE system design. Key Logic, Inc, SEC009-01, 1989. http://www.cis.upenn.edu/~KeyKOSGoogle ScholarGoogle Scholar
  32. Martin Rinard, Alexandru Salcianu, and Suhabe Bugrara. A Classification System and Analysis for Aspect-Oriented Programs. In Proc. Intl. Sym. on the Foundations of Software Engineering, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. T. Stephen Strickland and Matthias Felleisen. Contracts for First-Class Classes. In Proc. Dynamic Languages Symposium, pp. 97--112, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Sam Tobin-Hochstadt and Matthias Felleisen. The Design and Implementation of Typed Scheme. In Proc. ACM Sym. Principles of Programming Languages, pp. 395--406, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Tom Van Cutsem and Mark Miller. Proxies: Design Principles for Robust Object-oriented Intercession APIs. In Proc. Dynamic Languages Symposium, pp. 59--72, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Tom Van Cutsem and Mark Miller. On the design of the ECMAScript Reflection API. Vrije Universiteit Brussel, VUB-SOFT-TR-12-03, 2012.Google ScholarGoogle Scholar

Index Terms

  1. Chaperones and impersonators: run-time support for reasonable interposition

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 47, Issue 10
      OOPSLA '12
      October 2012
      1011 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2398857
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '12: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
        October 2012
        1052 pages
        ISBN:9781450315616
        DOI:10.1145/2384616

      Copyright © 2012 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 19 October 2012

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!