Object-oriented aspects of M OBY

Typical class-based languages, such as C#, C ++, and JAVA , provide complex class mechanisms but only weak module systems. These languages incorporate many of the features of rich module systems into their class constructs. In this paper, we describe an alternative approach. In our design, we rely on a rich ML-style module system to provide features such as visibility control and parameterization, while providing a minimal class mechanism that includes only those features needed to support inheritance. Programmers can then use the combination of modules and classes to implement the full range of class-based features and idioms. Our approach has the advantage that it provides a full-featured module system (useful in its own right), while keeping the class mechanism simple. We have incorporated this design into M OBY, which is an ML-style language that supports class-based object-oriented programming. In this paper, we describe our design via a series of simple examples, show how various class-based features and idioms are realized in M OBY, and compare our design with others.

[1]  David B. MacQueen Modules for standard ML , 1984, LFP '84.

[2]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[3]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[4]  William R. Cook,et al.  A Proposal for Making Eiffel Type-Safe , 1989, Comput. J..

[5]  William R. Cook,et al.  Inheritance is not subtyping , 1989, POPL '90.

[6]  William R. Cook,et al.  Mixin-based inheritance , 1990, OOPSLA/ECOOP '90.

[7]  Luca Cardelli,et al.  Modula-3 Report (revised) , 1992 .

[8]  Clemens A. Szyperski,et al.  Import is Not Inheritance - Why We Need Both: Modules and Classes , 1992, ECOOP.

[9]  Luca Cardelli An implementation of F , 1993 .

[10]  Alexander Aiken,et al.  Type inclusion constraints and type inference , 1993, FPCA '93.

[11]  Xavier Leroy,et al.  Manifest types, modules, and separate compilation , 1994, POPL '94.

[12]  Bjarne Stroustrup,et al.  The Design and Evolution of C , 1994 .

[13]  Didier Rémy,et al.  Type inference for records in natural extension of ML , 1994 .

[14]  John C. Mitchell,et al.  The Development of Type Systems for Object-Oriented Languages , 1995, Theory Pract. Object Syst..

[15]  Scott F. Smith,et al.  Type inference for recursively constrained types and its application to OOP , 1995, MFPS.

[16]  Andrew K. Wright Simple imperative polymorphism , 1995, LISP Symb. Comput..

[17]  John H. Reppy,et al.  Classes in Object ML via Modules , 1996 .

[18]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[19]  Ken Arnold,et al.  The Java Programming Language , 1996 .

[20]  John C. Mitchell,et al.  Type systems for object-oriented programming languages , 1996 .

[21]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[22]  Kim B. Bruce,et al.  Subtyping Is Not a Good "Match" for Object-Oriented Languages , 1997, ECOOP.

[23]  Jerome Vouillon Using modules as classes , 1997 .

[24]  Matthias Felleisen,et al.  Units: cool modules for HOT languages , 1998, PLDI.

[25]  John H. Reppy,et al.  Foundations for MOBY Classes , 1998 .

[26]  Didier Rémy,et al.  Objective ML: An Effective Object-Oriented Extension to ML , 1998, Theory Pract. Object Syst..

[27]  Kim B. Bruce,et al.  Modules in LOOM: Classes are not enough , 1998 .

[28]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[29]  Benjamin C. Pierce,et al.  Local type inference , 1998, POPL '98.

[30]  John H. Reppy,et al.  The design of a class mechanism for Moby , 1999, PLDI '99.

[31]  Martin Odersky,et al.  Colored local type inference , 2001, POPL '01.

[32]  Jérôme Vouillon Combining subsumption and binary methods: an object calculus with views , 2001, POPL '01.

[33]  Matthew Flatt,et al.  Jiazzi: new-age components for old-fasioned Java , 2001, OOPSLA '01.

[34]  Davide Ancona,et al.  True Modules for Java-like Languages , 2001, ECOOP.

[35]  Bowen Alpern,et al.  Efficient implementation of Java interfaces: Invokeinterface considered harmless , 2001, OOPSLA '01.

[36]  Jon G. Riecke,et al.  Privacy via Subsumption , 2002, Inf. Comput..

[37]  Damien Doligez,et al.  The Objective Caml system release 2.04 , 2002 .

[38]  Davide Ancona,et al.  A calculus of module systems , 2002, J. Funct. Program..

[39]  Kim B. Bruce,et al.  PolyTOIL: A type-safe polymorphic object-oriented language , 1995, TOPL.

[40]  Oscar Nierstrasz,et al.  Traits: Composable Units of Behaviour , 2002, ECOOP.

[41]  Peter H. Golde,et al.  C# Language Specification , 2003 .