Complete Monitors for Behavioral Contracts

  • Christos Dimoulas
  • Sam Tobin-Hochstadt
  • Matthias Felleisen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7211)


A behavioral contract in a higher-order language may invoke methods of unknown objects. Although this expressive power allows programmers to formulate sophisticated contracts, it also poses a problem for language designers. Indeed, two distinct semantics have emerged for such method calls, dubbed lax and picky. While lax fails to protect components in certain scenarios, picky may blame an uninvolved party for a contract violation.

In this paper, we present complete monitoring as the fundamental correctness criterion for contract systems. It demands correct blame assignment as well as complete monitoring of all channels of communication between components. According to this criterion, lax and picky are indeed incorrect ways to monitor contracts. A third semantics, dubbed indy, emerges as the only correct variant.


higher-order programming behavioral contracts contract checking 


  1. 1.
    Blume, M., McAllester, D.: Sound and complete models of contracts. Journal of Functional Programming 16(4-5), 375–414 (2006)MathSciNetzbMATHCrossRefGoogle Scholar
  2. 2.
    Dimoulas, C., Felleisen, M.: On contract satisfaction in a higher-order world. ACM Transactions on Programming Languages and Systems (TOPLAS) 33(5), 16:1 – 16:29 (2011)CrossRefGoogle Scholar
  3. 3.
    Dimoulas, C., Findler, R.B., Flanagan, C., Felleisen, M.: Correct blame for contracts: No more scapegoating. In: POPL, pp. 215 – 226 (2011)Google Scholar
  4. 4.
    Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ICFP, pp. 48–59 (2002)Google Scholar
  5. 5.
    Flatt, M.: PLT: Reference: Racket. Tech. Rep. PLT-TR-2010-1, PLT Inc. (2010),
  6. 6.
    Greenberg, M., Pierce, B.C., Weirich, S.: Contracts made manifest. In: POPL, pp. 353–364 (2010)Google Scholar
  7. 7.
    Meyer, B.: Eiffel: The Language. Prentice Hall (1992)Google Scholar
  8. 8.
    Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: from scripts to programs. In: DLS, pp. 964–974 (2006)Google Scholar
  9. 9.
    Wadler, P., Findler, R.B.: Well-Typed Programs Can’t Be Blamed. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 1–16. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  10. 10.
    Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Information and Computation 115(1), 38–94 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Zdancewic, S., Grossman, D., Morrisett, G.: Principals in programming languages: A syntactic proof technique. In: ICFP, pp. 197–207 (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Christos Dimoulas
    • 1
  • Sam Tobin-Hochstadt
    • 1
  • Matthias Felleisen
    • 1
  1. 1.Northeastern UniversityBostonUSA

Personalised recommendations