Abstract
First-class classes add expressive power to class-based object-oriented languages. Most importantly, programmers can abstract over common scenarios with first-class classes. When it comes to behavioral software contracts, however, first-class classes pose significant challenges. In this paper, we present the first contract system for a programming language with first-class classes. The design has been implemented for Racket, which supports first-class classes and which implements mixins and traits as syntactic sugar. We expect that our experience also applies to languages with native mixins and/or traits.
- }}Eric Allen, Jonathan Bannet, and Robert Cartwright. A first-class approach to genericity. In Object-Oriented Programming, Systems, Languages, and Applications, pages 96--114, 2003. Google Scholar
Digital Library
- }}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 Version 1.0. Sun Microsystems, 2008.Google Scholar
- }}Davide Ancona, Giovanni Lagorio, and Elena Zucca. Jam - designing a Java extension with mixins. ACM Trans. Program. Lang. Syst., 25(5):641--712, 2003. Google Scholar
Digital Library
- }}Mike Barnett, K. Rustan, M. Leino, and Wolfram Schulte. The Spec# programming system: An overview. In Construction and Analysis of Safe, Secure and Interoperable Smart devices, volume 3362 of LNCS, pages 49--69. Springer, 2004. Google Scholar
Digital Library
- }}Detlef Bartetzko, Clemens Fischer, Michael Moller, and Heike Wehrheim. Jass - Java with assertions. Electronic Notes in Theoretical Computer Science, 55(2):103--117, 2001.Google Scholar
Cross Ref
- }}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 Scholar
Digital Library
- }}Gilad Bracha and William Cook. Mixin-based inheritance. In Object-Oriented Programming, Systems, Languages, and Applications/European Conference on Object-Oriented Programming, pages 303--311, Ottawa, Canada, 1990. Google Scholar
Digital Library
- }}M. Carrillo-Castellon, J. Garcia-Molina, E. Pimentel, and I. Repiso. Design by contract in Smalltalk. Journal of Object-Oriented Programming, 7(9):23--28, 1996.Google Scholar
- }}Dominic Duggan and Ching-Ching Techaubol. Modular mixin-based inheritance for application frameworks. In Object-Oriented Programming, Systems, Languages, and Applications, pages 223--240, 2001. Google Scholar
Digital Library
- }}Erik Ernst. gbeta - a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, University of Aarhus, Århus, Denmark, 1999.Google Scholar
- }}Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi. A functional I/O system, or fun for freshman kids. In International Conference on Functional Programming, pages 47--58, September 2009. Google Scholar
Digital Library
- }}R. Findler and M. Felleisen. Contract soundness for object-oriented languages. In Object-Oriented Programming, Systems, Languages, and Applications, pages 1--15, 2001. Google Scholar
Digital Library
- }}Robert Bruce Findler and Matthias Blume. Contracts as pairs of projections. In Functional and Logic Programming, volume 3945 of LNCS, pages 226--241. Springer, April 2006. Google Scholar
Digital Library
- }}Robert Bruce Findler, John Clements, Cormac Flanagan, Matthew Flatt, Shriram Krishnamurthi, Paul Steckler, and Matthias Felleisen. DrScheme: A programming environment for Scheme. Journal of Functional Programming, 12(2):159--182, March 2002. Google Scholar
Digital Library
- }}Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In International Conference on Functional Programming, pages 48--59, October 2002. Google Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In Symposium on Principles of Programming Languages, pages 171--183, January 1998. Google Scholar
Digital Library
- }}Matthew Flatt and PLT. Reference: Racket. Technical Report PLT-TR2010-1, PLT Inc., June 7, 20http://racket-lang.org/tr1/.Google Scholar
- }}Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Massachusetts, 1994. Google Scholar
Digital Library
- }}Adele Goldberg and David Robinson. Smalltalk-80: The Language and its Implementation. Addison-Wesley, 1983. Google Scholar
Digital Library
- }}David S. Goldberg, Robert Bruce Findler, and Matthew Flatt. Super and inner - together at last! In Object-Oriented Programming, Systems, Languages, and Applications, pages 116--129, 2004. Google Scholar
Digital Library
- }}Benedict Gomes, David Stoutamire, Boris Vaysman, and Holger Klawitter. A Language Manual for Sather 1.1, August 1996.Google Scholar
- }}J. Gosling, B. Joy, and G. L.Steele. The Java Language Specification. Addison-Welsley, 1996. Google Scholar
Digital Library
- }}Murat Karaorman, Urs Hölzle, and John Bruno. jContractor: A reflective Java library to support design by contract. In Proceedings of Meta-Level Architectures and Reflection, volume 1616 of LNCS, pages 175--196, July 1999. Google Scholar
Digital Library
- }}Casey Klein, Matthew Flatt, and Robert Bruce Findler. Random testing for higher-order, stateful programs. In Object-Oriented Programming, Systems, Languages, and Applications, 2010. To appear. Google Scholar
Digital Library
- }}Michael Kolling and John Rosenberg. Blue: Language Specification, version 0.94, 1997.Google Scholar
- }}Reto Kramer. iContract: The Java design by contract tool. In Technology of Object-Oriented Languages and Systems, page 295, 1998. Google Scholar
Digital Library
- }}John Lamping. Typing the specialization interface. In Object-Oriented Programming, Systems, Languages, and Applications, pages 201--214, September 1993. Google Scholar
Digital Library
- }}B. W. Lampson, J. J. Horning, R. L. London, J. G. Mitchell, and G. J. Popek. Report on the programming language Euclid. SIGPLAN Not., 12(2):1--79, February 1977. Google Scholar
Digital Library
- }}Gary T. Leavens, Yoonsik Cheon, Curtis Clifton, Clyde Ruby, and David R. Cok. How the design of JML accommodates both runtime assertion checking and formal verification. Sci. Comput. Program., 55(1-3):185--208, 2005. Google Scholar
Digital Library
- }}Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. Object-oriented programming in the BETA programming language. Addison-Wesley Publishing Co., New York, NY, USA, 1993. Google Scholar
Digital Library
- }}Xavier Leroy. The Objective Caml system, Documentation and User's guide, 1997.Google Scholar
- }}Barbara H. Liskov and Jeannette M. Wing. A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems, 16(6):1811--1841, November 1994. Google Scholar
Digital Library
- }}D. C. Luckham and F.W. von Henke. An overview of Anna, a specification language for Ada. In IEEE Software, volume 2, pages 9--23, March 1985. Google Scholar
Digital Library
- }}Sean McDirmid, Matthew Flatt, and Wilson Hsieh. Jiazzi: new-age components for old-fashioned Java. In Object-Oriented Programming, Systems, Languages, and Applications, pages 211--222, 2001. Google Scholar
Digital Library
- }}Bertrand Meyer. Object-oriented Software Construction. Prentice Hall, 1988. Google Scholar
Digital Library
- }}Bertrand Meyer. Applying design by contract. IEEE Computer, 25(10):40--51, October 1992. Google Scholar
Digital Library
- }}Bertrand Meyer. Eiffel: The Language. Prentice Hall, 1992. Google Scholar
Digital Library
- }}David A. Moon. Object-oriented programming with flavors. In Object-Oriented Programming, Systems, Languages, and Applications, pages 1--8, 1986. Google Scholar
Digital Library
- }}Martin Odersky. The Scala Language Specification. Ecole Polytechnique Fédérale de Lausanne, 2009.Google Scholar
- }}David L. Parnas. On the criteria to be used in decomposing systems into modules.Communications of the ACM, 15:1053--1058, 1972. Google Scholar
Digital Library
- }}R. Plösch. Design by contract for Python. In IEEE Proceedings of the Joint Asia Pacific Software Engineering Conference, pages 213--219, December 1997. Google Scholar
Digital Library
- }}Didier Rémy and Jérôme Vouillon. Objective ML: A simple object-oriented extension of ML. In Symposium on Principles of Programming Languages, pages 40--53, January 1997. Google Scholar
Digital Library
- }}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 Scholar
- }}Michael Sperber, R. Kent Dybvig, Matthew Flatt, Anton Van Straaten, Robby Findler, and Jacob Matthews. Revised6 report on the algorithmic language Scheme. Journal of Functional Programming, 19(Supplement S1):1--301, 2009. Google Scholar
Digital Library
- }}T. Stephen Strickland and Matthias Felleisen. Contracts for first-class modules. In Symposium on Dynamic Languages, pages 27--38, October 2009. Google Scholar
Digital Library
- }}T. Stephen Strickland and Matthias Felleisen. Nested and dynamic contract boundaries. In Implementation and Application of Functional Languages, September 2009. To appear. Google Scholar
Digital Library
- }}T. Stephen Strickland and Matthias Felleisen. Contracts for first-class classes. Technical Report NU-CCIS-10-04, Northeastern University, 2010.Google Scholar
Digital Library
- }}Clemens Szyperski. Component Software. Addison-Wesley, 1997.Google Scholar
Index Terms
Contracts for first-class classes
Recommendations
Contracts for first-class classes
DLS '10: Proceedings of the 6th symposium on Dynamic languagesFirst-class classes add expressive power to class-based object-oriented languages. Most importantly, programmers can abstract over common scenarios with first-class classes. When it comes to behavioral software contracts, however, first-class classes ...
Contracts for First-Class Classes
First-class classes enable programmers to abstract over patterns in the class hierarchy and to experiment with new forms of object-oriented programming such as mixins and traits. This increase in expressive power calls for tools to control the ...
Classes as first class objects in an environment-passing interpreter
We describe an expression-based programming language that treats classes as first-class objects. We show an implementation of this language using an environment-passing interpreter accessible to students in a programming language class. We also show how ...







Comments