Abstract
Inheritance is a useful mechanism for factoring and reusing code. However, it has limitations for building extensible systems. We describe <i>nested inheritance</i>, a mechanism that addresses some of the limitations of ordinary inheritance and other code reuse mechanisms. Using our experience with an extensible compiler framework, we show how nested inheritance can be used to construct highly extensible software frameworks. The essential aspects of nested inheritance are formalized in a simple object-oriented language with an operational semantics and type system. The type system of this language is sound, so no run-time type checking is required to implement it and no run-time type errors can occur. We describe our implementation of nested inheritance as an unobtrusive extension of the Java language, called Jx. Our prototype implementation translates Jx code to ordinary Java code, without duplicating inherited code.
References
- Davide Ancona, Giovanni Lagorio, and Elena Zucca. Jam: A smooth extension of Java with mixins. In Proc. ECOOP '00, LNCS 1850, pages 154--178, Cannes, France, 2000.]] Google Scholar
Digital Library
- Gilad Bracha and William Cook. Mixin-based inheritance. In Norman Meyrowitz, editor, Proc. OOPSLA '90, pages 303--311, Ottawa, Canada, 1990. ACM Press.]] Google Scholar
Digital Library
- Kim B. Bruce, Adrian Fiech, and Leaf Petersen. Subtyping is not a good "match" for object-oriented languages. In Proceedings of 11th European Conference on Object-Oriented Programming (ECOOP'97), number 1241 in Lecture Notes in Computer Science, pages 104--127, Jyväskylä, Finland, June 1997. Springer-Verlag.]]Google Scholar
Cross Ref
- Kim B. Bruce, Martin Odersky, and Philip Wadler. A statically safe alternative to virtual types. In European Conference on Object-Oriented Programming (ECOOP), number 1445 in Lecture Notes in Computer Science, pages 523--549, Brussels, Belgium, July 1998. Springer-Verlag.]] Google Scholar
Digital Library
- Kim B. Bruce, Angela Schuett, and Robert van Gent. PolyTOIL: A type-safe polymorphic object-oriented language. In European Conference on Object-Oriented Programming (ECOOP), number 952 in Lecture Notes in Computer Science, pages 27--51. Springer-Verlag, 1995.]] Google Scholar
Digital Library
- Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein. MultiJava: Modular open classes and symmetric multiple dispatch for Java. In OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, volume 35(10), pages 130--145, 2000.]] Google Scholar
Digital Library
- O.-J. Dahl et al. The Simula 67 common base language. Publication No. S-22, Norwegian Computing Center, Oslo, 1970.]]Google Scholar
- Erik Ernst. gbeta - a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, Department of Computer Science, University of Aarhus, Århus, Denmark, 1999.]]Google Scholar
- Erik Ernst. Family polymorphism. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP), LNCS 2072, pages 303--326, Heidelberg, Germany, 2001. Springer-Verlag.]] Google Scholar
Digital Library
- Erik Ernst. Higher-order hierarchies. In Proceedings of the 17th European Conference on Object-Oriented Programming (ECOOP), volume 2743 of Lecture Notes in Computer Science, pages 303--329, Heidelberg, Germany, July 2003. Springer-Verlag.]]Google Scholar
Cross Ref
- Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In Proc. 25th ACM Symp. on Principles of Programming Languages (POPL), pages 171--183, San Diego, California, 1998.]] Google Scholar
Digital Library
- Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading, MA, 1994.]] Google Scholar
Digital Library
- James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java Language Specification. Addison Wesley, 2nd edition, 2000. ISBN 0-201-31008-2.]] Google Scholar
Digital Library
- Carl Gunter and John C. Mitchell, editors. Theoretical aspects of object-oriented programming. MIT Press, 1994.]] Google Scholar
Digital Library
- Atsushi Igarashi, Benjamin Pierce, and Philip Wadler. Foundations for virtual types. In Proceedings of the Thirteenth European Conference on Object-Oriented Programming (ECOOP'99), number 1628 in Lecture Notes in Computer Science, pages 161--185. Springer-Verlag, June 1999.]] Google Scholar
Digital Library
- Atsushi Igarashi, Benjamin Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396--450, 2001.]] Google Scholar
Digital Library
- Atsushi Igarashi and Benjamin C. Pierce. On inner classes. Information and Computation, 177(1):56--89, August 2002.]] Google Scholar
Digital Library
- Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersen, Jeffrey Palm, and William G. Griswold. An overview of AspectJ. In Proceedings of European Conference on Object-Oriented Programming (ECOOP'01), volume 2072 of Lecture Notes in Computer Science, pages 327--353, Berlin, Heidelberg, and New York, 2001. Springer-Verlag.]] Google Scholar
Digital Library
- Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Proceedings of 11th European Conference on Object-Oriented Programming (ECOOP'97), number 1241 in Lecture Notes in Computer Science, pages 220-242, Jyväskylä, Finland, June 1997. Springer-Verlag.]]Google Scholar
Cross Ref
- B. Liskov et al. CLU reference manual. In Goos and Hartmanis, editors, Lecture Notes in Computer Science, volume 114. Springer-Verlag, Berlin, 1981.]] Google Scholar
Digital Library
- O. Lehrmann Madsen, B. Moller-Pedersen, and K. Nygaard. Object Oriented Programming in the BETA Programming Language. Addison-Wesley, June 1993.]] Google Scholar
Digital Library
- Ole Lehrmann Madsen and Birger Moller-Pedersen. Virtual classes: A poweful mechanism for object-oriented programming. In Proc. OOPSLA '89, pages 397--406, October 1989.]] Google Scholar
Digital Library
- Sean McDirmid, Matthew Flatt, and Wilson C. Hsieh. Jiazzi: New-age components for old-fashioned Java. In Proc. OOPSLA '01, October 2001.]] Google Scholar
Digital Library
- Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.]] Google Scholar
Digital Library
- Andrew C. Myers, Lantian Zheng, Steve Zdancewic, Stephen Chong, and Nathaniel Nystrom. Jif: Java information flow. Software release. Located at http://www.cs.cornell.edu/jif, July 2001-2003.]]Google Scholar
- Nathaniel Nystrom, Stephen Chong, and Andrew C. Myers. Scalable extensibility via nested inheritance. Technical Report 2004-1940, Computer Science Dept., Cornell University, June 2004.]]Google Scholar
- Nathaniel Nystrom, Michael Clarkson, and Andrew C. Myers. Polyglot: An extensible compiler framework for Java. In Görel Hedin, editor, Compiler Construction, 12th International Conference, CC 2003, number 2622 in Lecture Notes in Computer Science, pages 138--152, Warsaw, Poland, April 2003. Springer-Verlag.]] Google Scholar
Digital Library
- Martin Odersky, Philippe Altherr, Vincent Cremet, Burak Emir, Sebastian Maneth, Stephane Micheloud, Nikolay Mihaylov, Michel Schinz, Erik Stenman, and Matthias Zenger. An overview of the Scala programming language, June 2004. http://scala.epfl.ch/docu/files/-ScalaOverview.pdf.]]Google Scholar
- Martin Odersky, Vincent Cremet, Christine Röckl, and Matthias Zenger. A nominal theory of objects with dependent types. In Proceedings of 17th European Conference on Object-Oriented Programming (ECOOP 2003), number 2743 in Lecture Notes in Computer Science, pages 201--224. Springer-Verlag, July 2003.]]Google Scholar
Cross Ref
- Martin Odersky and Christoph Zenger. Nested types. In 8th Workshop on Foundations of Object-Oriented Languages (FOOL), 2001.]]Google Scholar
- Klaus Ostermann. Dynamically composable collaborations with delegation layers. In Proceedings of the 16th European Conference on Object-Oriented Programming (ECOOP), volume 2374 of Lecture Notes in Computer Science, pages 89--110, Málaga, Spain, 2002. Springer-Verlag.]] Google Scholar
Digital Library
- John C. Reynolds. User-defined types and procedural data structures as complementary approaches to data abstraction. In Stephen A. Schuman, editor, New Directions in Algorithmic Languages, pages 157--168. Institut de Recherche d'Informatique et d'Automatique, Le Chesnay, France, 1975. Reprinted in {14}, pages 13--23.]]Google Scholar
- Yannis Smaragdakis and Don Batory. Implementing layered design with mixin layers. In Eric Jul, editor, Proceedings ECOOP'98, pages 550--570, Brussels, Belgium, 1998.]] Google Scholar
Digital Library
- B. Stroustrup. The C++ Programming Language. Addison-Wesley, 1987.]] Google Scholar
Digital Library
- Kresten Krab Thorup. Genericity in Java with virtual types. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), number 1241 in Lecture Notes in Computer Science, pages 444--471. Springer-Verlag, 1997.]]Google Scholar
Cross Ref
- Mads Torgerson. Virtual types are statically safe. In 5th Workshop on Foundations of Object-Oriented Languages (FOOL), January 1998.]]Google Scholar
- Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38--94, 1994.]] Google Scholar
Digital Library
- Matthias Zenger and Martin Odersky. Extensible algebraic datatypes with defaults. In Proc. 6th ACM SIGPLAN International Conference on Functional Programming (ICFP), Firenze, Italy, September 2001.]] Google Scholar
Digital Library
- Matthias Zenger and Martin Odersky. Independently extensible solutions to the expression problem. Technical Report IC/2004/33, École Polytechnique Fédérale de Lausanne, March 2004.]]Google Scholar
Index Terms
Scalable extensibility via nested inheritance






Comments