|
ABSTRACT
Multiple inheritance has long been plagued with the "diamond" inheritance problem, leading to solutions that restrict expressiveness, such as mixins and traits. Instead, we address the diamond problem directly, considering two difficulties it causes: ensuring a correct semantics for object initializers, and typechecking multiple dispatch in a modular fashion-the latter problem arising even with multiple interface inheritance. We show that previous solutions to these problems are either unsatisfactory or cumbersome, and suggest a novel approach: supporting multiple inheritance but forbidding diamond inheritance. Expressiveness is retained through two features: a "requires" construct that provides a form of subtyping without inheritance (inspired by Scala), and a dynamically-dispatched "super" call similar to that found in traits. Through examples, we illustrate that inheritance diamonds can be eliminated via a combination of "requires" and ordinary inheritance. We provide a sound formal model for our language and demonstrate its modularity and expressiveness.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
R. Agrawal, L. DeMichiel, and B. Lindsay. Static type checking of multi-methods. In OOPSLA, pages 113--128, 1991.
|
| |
2
|
E. Allen, D. Chase, J. Hallett, V. Luchangco, J. Maessen, S. Ryu, G. Steele, Jr., and S. Tobin-Hochstadt. The Fortress Language Specification, Version 1.0. Available at http://research.sun.com/projects/plrg/Publications/fortress.1.0.pdf, 2008. Accessed 3/09.
|
| |
3
|
E. Allen, J. J. Hallett, V. Luchangco, S. Ryu, and G. L. Steele Jr. Modular multiple dispatch with multiple inheritance. In SAC '07, pages 1117--1121. ACM, 2007.
|
| |
4
|
D. Ancona, G. Lagorio, and E. Zucca. Jam - designing a Java extension with mixins. ACM Trans. Program. Lang. Syst., 25(5):641--712, 2003.
|
| |
5
|
D. Ancona and E. Zucca. An algebraic approach to mixins and modularity. In Algebraic and Logic Programming, pages 179--193, 1996.
|
| |
6
|
G. Baumgartner, M. Jansche, and K. Laufer. Half & Half: Multiple dispatch and retroactive abstraction for Java. Technical Report OSU-CISRC-5/01-TR08, Dept. of Computer and Information Science, The Ohio State University, March 2002.
|
| |
7
|
A. Bergel. Personal communication, October 2008.
|
| |
8
|
A. Bergel, S. Ducasse, O. Nierstrasz, and R. Wuyts. Stateful traits and their formalization. Computer Languages, Systems & Structures, 34(2-3):83--108, 2008.
|
| |
9
|
L. Bettini, V. Bono, and S. Likavec. A core calculus of higher-order mixins and classes. In SAC, pages 1508--1509, 2004.
|
| |
10
|
J. Bloch. Effective Java: Programming Language Guide. Addison-Wesley, 2001.
|
| |
11
|
J. Boyland and G. Castagna. Parasitic methods: An implementation of multi-methods for Java. In OOPSLA, pages 66--76, 1997.
|
| |
12
|
G. Bracha and W. Cook. Mixin-based inheritance. In ECOOP '90, 1990.
|
| |
13
|
B. Carré and J. Geib. The point of view notion for multiple inheritance. In OOPSLA/ECOOP '90, pages 312--321. ACM, 1990.
|
| |
14
|
C. Chambers. Object-oriented multi-methods in Cecil. In ECOOP '92, 1992.
|
| |
15
|
C. Chambers and the Cecil Group. The Cecil language: specification and rationale, Version 3.2. Available at http://www.cs.washington.edu/research/projects/cecil/, 2004. Accessed 3/09.
|
| |
16
|
C. Clifton, G. T. Leavens, C. Chambers, and T. Millstein. MultiJava: modular open classes and symmetric multiple dispatch for Java. In OOPSLA '00, pages 130--145, 2000.
|
| |
17
|
C. Clifton, T. Millstein, G. T. Leavens, and C. Chambers. MultiJava: Design rationale, compiler implementation, and applications. ACM Trans. Program. Lang. Syst., 28(3):517--575, 2006.
|
| |
18
|
W. Cook, W. Hill, and P. Canning. Inheritance is not subtyping. In POPL, pages 125--135, 1990.
|
| |
19
|
S. Ducasse, O. Nierstrasz, N. Scharli, R. Wuyts, and A.P. Black. Traits: A mechanism for fine-grained reuse. ACM Trans. Program. Lang. Syst., 28(2):331--388, 2006.
|
| |
20
|
T. Ekman and G. Hedin. JastAdd. http://www.jastadd.org, 2008. Accessed 3/09.
|
| |
21
|
M. Ellis and B. Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1990.
|
| |
22
|
R.B. Findler and M. Flatt. Modular object-oriented programming with units and mixins. ACM SIGPLAN Notices, 34(1):94--104, 1999.
|
| |
23
|
K. Fisher and J. Reppy. A typed calculus of traits. In Proceedings of the 11th Workshop on Foundations of Object-oriented Programming, January 2004.
|
| |
24
|
M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. In POPL '98, 1998.
|
| |
25
|
C. Frost and T. Millstein. Modularly typesafe interface dispatch in JPred. In FOOL/WOOD'06, January 2006.
|
| |
26
|
D. Hovemeyer and W. Pugh. Finding bugs is easy. SIGPLAN Not., 39(12):92--106, 2004.
|
| |
27
|
N. C. Hutchinson. EMERALD: An object-based language for distributed programming. PhD thesis, University of Washington, Seattle, WA, USA, 1987.
|
| |
28
|
A. Igarashi, B. Pierce, and P. Wadler. Featherwieght Java: a Minimal Core Calculus for Java and GJ. In OOPSLA '99, November 1999.
|
| |
29
|
E. Johnsen, O. Owe, and I. Yu. Creol: A type-safe object-oriented model for distributed concurrent systems. Theor. Comput. Sci., 365(1):23--66, 2006.
|
| |
30
|
D. Malayeri. CZ: Multiple inheritance without diamonds. In FOOL '09, January 2009.
|
| |
31
|
D. Malayeri and J. Aldrich. CZ: Multimethods and multiple inheritance without diamonds. Technical Report CMU-CS-09-153, School of Computer Science, Carnegie Mellon University, August 2009.
|
| |
32
|
B. Meyer. Object-Oriented Software Construction, 2nd Edition. Prentice-Hall, 1997.
|
| |
33
|
S. Meyers. Effective C++: 50 specific ways to improve your programs and designs. Addison Wesley Longman Publishing Co., Inc. Redwood City, CA, USA, 1992.
|
| |
34
|
Microsoft Corporation. C# language specification, version 3.0. Available at http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75%351c669b09/csharp%20language%20specification.doc, 2007. Accessed 8/09.
|
| |
35
|
T. Millstein, C. Bleckner, and C. Chambers. Modular typechecking for hierarchically extensible datatypes and functions. In ICFP '02, 2002.
|
| |
36
|
T. Millstein, C. Bleckner, and C. Chambers. Modular typechecking for hierarchically extensible datatypes and functions. ACM Trans. Program. Lang. Syst., 26(5):836--889, 2004.
|
| |
37
|
T. Millstein and C. Chambers. Modular statically typed multimethods. Inf. Comput., 175(1):76--118, 2002.
|
| |
38
|
N. Nystrom, S. Chong, and A. Myers. Scalable extensibility via nested inheritance. In OOPSLA '04, pages 99--115, 2004.
|
| |
39
|
M. Odersky. The Scala language specification. Available at http://www.scala-lang.org/docu/files/ScalaReference.pdf, 2007. Accessed 3/09.
|
| |
40
|
M. Odersky and M. Zenger. Scalable Component Abstractions. In OOPSLA '05, 2005.
|
| |
41
|
A. Paepcke. Object-Oriented Programming: The CLOS Perspective. The MIT Press, 1993.
|
| |
42
|
P. Pirkelbauer, Y. Solodkyy, and B. Stroustrup. Open multi-methods for C++. In GPCE '07, pages 123--134, 2007.
|
| |
43
|
M. Sakkinen. Disciplined inheritance. In ECOOP, pages 39--56, 1989.
|
| |
44
|
N. Scharli, S. Ducasse, O. Nierstrasz, and A.P. Black. Traits: Composable Units of Behaviour. In ECOOP '03. Springer, 2003.
|
| |
45
|
A. Shalit. The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language. Addison-Wesley, 1997.
|
| |
46
|
G. Singh. Single versus multiple inheritance in object oriented programming. SIGPLAN OOPS Mess., 5(1):34--43, 1994.
|
| |
47
|
A. Snyder. Encapsulation and inheritance in object-oriented programming languages. In OOPSLA, pages 38--45, 1986.
|
| |
48
|
G. L. Steele, Jr. Common LISP: The Language. Digital Press, second edition, 1990.
|
| |
49
|
C. Szyperski, S. Omohundro, and S. Murer. Engineering a programming language: The type and class system of Sather. In J. Gutknecht, editor, Programming Languages and System Architectures, volume 782 of Lecture Notes in Computer Science. Springer, 1993.
|
| |
50
|
G. Washburn. Personal communication, December 2008.
|
|