Nothing Special   »   [go: up one dir, main page]

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

CZ: multiple inheritance without diamonds

Published: 25 October 2009 Publication History

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

[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.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '09: Proceedings of the 24th ACM SIGPLAN conference on Object oriented programming systems languages and applications
October 2009
590 pages
ISBN:9781605587660
DOI:10.1145/1640089
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 44, Issue 10
    OOPSLA '09
    October 2009
    554 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1639949
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 October 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. diamond problem
  2. modularity
  3. multimethods
  4. multiple inheritance

Qualifiers

  • Research-article

Conference

OOPSLA09
Sponsor:

Acceptance Rates

OOPSLA '09 Paper Acceptance Rate 25 of 144 submissions, 17%;
Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)10
  • Downloads (Last 6 weeks)2
Reflects downloads up to 20 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2017)The Porphyrian Tree and Multiple Inheritance: A Rejoinder to Tylman on Computer Science and PhilosophyFoundations of Science10.1007/s10699-017-9531-123:1(173-180)Online publication date: 26-Jun-2017
  • (2016)Classless JavaACM SIGPLAN Notices10.1145/3093335.299323852:3(14-24)Online publication date: 20-Oct-2016
  • (2016)Classless JavaProceedings of the 2016 ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/2993236.2993238(14-24)Online publication date: 20-Oct-2016
  • (2016)Object MetamorphismProceedings of the 2015 Federated Conference on Software Development and Object Technologies10.1007/978-3-319-46535-7_24(311-335)Online publication date: 15-Dec-2016
  • (2014)InterStateProceedings of the 27th annual ACM symposium on User interface software and technology10.1145/2642918.2647358(263-272)Online publication date: 5-Oct-2014
  • (2013)Template constructors for reusable object initializationACM SIGPLAN Notices10.1145/2637365.251721249:3(43-52)Online publication date: 27-Oct-2013
  • (2013)Template constructors for reusable object initializationProceedings of the 12th international conference on Generative programming: concepts & experiences10.1145/2517208.2517212(43-52)Online publication date: 27-Oct-2013
  • (2013)Method Shells: Avoiding Conflicts on Destructive Class Extensions by Implicit Context SwitchesSoftware Composition10.1007/978-3-642-39614-4_4(49-64)Online publication date: 2013
  • (2012)UML – A Part of an Interlocking System Development ProcessTelematics in the Transport Environment10.1007/978-3-642-34050-5_33(293-300)Online publication date: 2012
  • (2012)MagdaProceedings of the 26th European conference on Object-Oriented Programming10.1007/978-3-642-31057-7_25(560-588)Online publication date: 11-Jun-2012
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media