skip to main content
10.1145/1640134.1640140acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Contracts for first-class modules

Published:26 October 2009Publication History

ABSTRACT

Behavioral software contracts express properties concerning the flow of values across component (modules, classes, etc) interfaces. These properties are often beyond the reach of theorem provers and are therefore monitored at run-time. When the monitor discovers a contract violation, it raises an exception that simultaneously pinpoints the contract violator and explains the nature of the violation.

Currently contract monitoring assumes static module interfaces. Specifically, the contract compiler partitions a contract into disjoint obligations for the static modules that communicate to an interface. At run-time, the information is used for catching and explaining contract violations. While static modules suffice for many situations, first-class modules - such as the units provided by PLT Scheme - support the dynamic and multiple linking that is often required in open software systems. The problem is, of course, that in such a world, it becomes impossible to tell from the source program alone which components have agreed to which contracts.

In this paper, we develop the semantic framework of monitoring contracts for dynamic modules. We establish the internal consistency of the semantics, and we sketch an implementation based on our experience of equipping PLT Scheme with such contracts.

References

  1. Eric Allen, David Chase, Joe Hallett, Victor Luchangco, Jan-Willem Maessen, Sukyoung Ryu, Guy L. Steele Jr., and Sam Tobin-Hochstadt. The Fortress Language Specification. Sun Microsystems, 2008.Google ScholarGoogle Scholar
  2. Antoine Beugnard, Jean-Marc Jézéquel, Noël Plouzeau, and Damien Watkins. Making components contract aware. In IEEE Software, pages 38--45, June 1999. Google ScholarGoogle Scholar
  3. Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics Engineering with PLT Redex. MIT Press, 2009a. Google ScholarGoogle Scholar
  4. Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi. A functional I/O system, or fun for freshman kids. In ACM SIGPLAN International Conference on Functional Programming, page to appear, September 2009b. Google ScholarGoogle Scholar
  5. Robert Bruce Findler and Matthias Blume. Contracts as pairs of projections. In Eighth International Symposium on Functional and Logic Programming, volume 3945 of LNCS, pages 226--241. Springer, April 2006. Google ScholarGoogle Scholar
  6. Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In ACM SIGPLAN International Conference on Functional Programming, pages 48--59, October 2002. Google ScholarGoogle Scholar
  7. Robert Bruce Findler and Matthew Flatt. Modular object-oriented programming with units and mixins. In ACM SIGPLAN International Conference on Functional Programming, pages 94--104, September 1998. Google ScholarGoogle Scholar
  8. Robert Bruce Findler, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. DrScheme: A pedagogic programming environment for Scheme. In Programming Languages: Implementations, Logics, and Programs, volume 1292 of LNCS, pages 369--388. Springer, September 1997. Google ScholarGoogle Scholar
  9. Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 236--248, June 1998. Google ScholarGoogle Scholar
  10. Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 171--183, January 1998. Google ScholarGoogle Scholar
  11. Matthew Flatt, Robert Bruce Findler, and Matthias Felleisen. Scheme with classes, mixins, and traits. In Asian Symposium on Programming Languages and Systems, pages 270--289, November 2006. Google ScholarGoogle Scholar
  12. Matthew Flatt et al. Reference: PLT Scheme. Reference Manual PLT-TR2009-reference-v4.1.4, PLT Scheme Inc., January 2009. http://plt-scheme.org/techreports/.Google ScholarGoogle Scholar
  13. Paul T. Graunke, Shriram Krishnamurthi, Steve van der Hoeven, and Matthias Felleisen. Programming the Web with high-level programming languages. In European Symposium on Programming, volume 2028 of LNCS, pages 122--136. Springer, April 2001. Google ScholarGoogle Scholar
  14. Xavier Leroy. Manifest types, modules, and separate compilation. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 109--122, January 1994. Google ScholarGoogle Scholar
  15. Bertrand Meyer. Applying design by contract. IEEE Computer, 25(10): 40--51, October 1992. Google ScholarGoogle Scholar
  16. Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Martin Odersky. The Scala Language Specification. Ecole Polytechnique Fédérale de Lausanne, 2009.Google ScholarGoogle Scholar
  18. Scott Owens and Matthew Flatt. From structures and functors to modules and units. In ACM SIGPLAN International Conference on Functional Programming, pages 87--98, September 2006. Google ScholarGoogle Scholar
  19. David L. Parnas. On the criteria to be used in decomposing systems into modules. Communications of the ACM, 15:1053--1058, 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Gordon D. Plotkin. Call-by-name, call-by-value, and the λ-calculus. Theoretical Computer Science, pages 125--159, 1975.Google ScholarGoogle Scholar
  21. Nathanael Schärli, Stéphane Ducasse, Oscar Nierstrasz, and Andrew Black. Traits: Composable units of behavior. In European Conference on Object-Oriented Programming, volume 2743 of LNCS, pages 248--274. Springer, July 2003.Google ScholarGoogle Scholar
  22. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, pages 38--94, 1994. First appeared as Technical Report TR160, Rice University, 1991.Google ScholarGoogle Scholar

Index Terms

  1. Contracts for first-class modules

          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

          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!