Abstract
While class-based object-oriented programming languages provide a flexible mechanism for re-using and managing related pieces of code, they typically lack linguistic facilities for specifying a uniform extension of many classes with one set of fields and methods. As a result, programmers are unable to express certain abstractions over classes. In this paper we develop a model of class-to-class functions that we refer to as mixins. A mixin function maps a class to an extended class by adding or overriding fields and methods. Programming with mixins is similar to programming with single inheritance classes, but mixins more directly encourage programming to interfaces. The paper develops these ideas within the context of Java. The results are
-
1.
an intuitive model of an essential Java subset;
-
2.
an extension that explains and models mixins; and
-
3.
type soundness theorems for these languages.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Abadi, M., and Cardelli, L. A theory of primitive objects — untyped and first-order systems. In Theoretical Aspects of Computer Software, M. Hagiya and J. C. Mitchell, Eds., vol. 789 of LNCS. Springer-Verlag, Apr. 1994, pp. 296–320.
Abadi, M., and Cardelli, L. A theory of primitive objects: second-order systems. In Proc. European Symposium on Programming (New York, N.Y., 1994), D. Sannella, Ed., Lecture Notes in Computer Science 788, Springer Verlag, pp. 1–25.
Abadi, M., and Cardelli, L. An imperative object calculus. In TAPSOFT’95: Theory and Practice of Software Development May 1995), P. D. Mosses, M. Nielsen, and M. I. Schwartzbach, Eds., Lecture Notes in Computer Science 915, Springer-Verlag, pp. 471–485.
Ancona, D., and Zucca, E. An algebraic approach to mixins and modularity. In Proc. Conference on Algebraic and Logic Programming (Berlin, 1996), M. Hanus and M. Rodríguez-Artalejo, Eds., Lecture Notes in Computer Science 1139, Springer Verlag, pp. 179–193.
Bracha, G. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. Ph.D. thesis, Dept. of Computer Science, University of Utah, Mar. 1992.
Bracha, G., and Cook, W. Mixin-based inheritance. In Proc. Joint ACM Conf. on Object-Oriented Programming, Systems, Languages and Applications and the European Conference on Object-Oriented Programming Oct. 1990.
Bracha, G., and Lindstrom, G. Modularity meets inheritance. In Proc. IEEE Computer Society International Conference on Computer Languages Washington, DC, Apr. 1992, IEEE Computer Society, pp. 282–290.
Cook, W. R.A Denotational Semantics of Inheritance. Ph.D. thesis, Department of Computer Science, Brown University, Providence, RI, May 1989.
Drossopolou, S., and Eisenbach, S. Java is typesafe-probably. In Proc. European Conference on Object Oriented Programming June 1997.
Ducournau, R., Habib, M., Huchard, M., and Mugnier, M. L. Monotonic conflict resolution mechanisms for inheritance. In Proc. Conference on Object-Oriented Programming Systems, Languages, and Applications Oct. 1992, pp. 16–24.
Eifrig, J., Smith, S., Trifonov, V., and Zwarico, A. Application of OOP type theory: State, decidability, integration. In Proc. Conference on Object-Oriented Programming Systems, Languages, and Applications Oct. 1994, pp. 16–30.
Felleisen, M. Programming languages and lambda calculi. URL: www.cs.rice.edu/~matthias/411web/mono.ps.
Felleisen, M., and Hieb, R. The revised report on the syntactic theories of sequential control and state. Tech. Rep. 100, Rice University, June 1989. Theoretical Computer Science, volume 102, 1992, pp. 235–271.
Findler, R. B., Flanagan, C., Flatt, M., Krishnamurthi, S., and Felleisen, M. DrScheme: A pedagogic programming environment for Scheme. In Proc. International Symposium on Programming Languages: Implementations, Logics, and Programs 1997, pp. 369–388.
Flatt, M. PLT MzScheme: Language manual. Tech. Rep. TR97-280, Rice University, 1997.
Gamma, E., Helm, R., Johnson, R., and Vlissides, J.Design Patterns: Elements of Reusable Object-Oriented Software. AddisonWesley, Massachusetts, 1994.
Gosling, J., Joy, B., and Steele, G.The Java Language Specification. The Java Series. Addison-Wesley, Reading, MA, USA, June 1996.
Harper, R., and Stone, C. A type-theoretic semantics for Standard ML 1996. Submitted for publication, 1997.
Kamin, S. Inheritance in SMALLTALK-80: a denotational definition. In Proc. ACM Symposium on Principles of Programming Languages Jan. 1988.
Kessler, R.R.LISP, Objects, and Symbolic Programming. Scott, Foresman and Company, Glenview, IL, USA, 1988.
Koschmann, T.The Common LISP Companion. John Wiley and Sons, New York, N.Y., 1990.
Mason, I.A., and Talcott, C. L. Reasoning about object systems in VTLoE. International Journal of Foundations of Computer Science 6,3 Sept. 1995, 265–298.
Palsberg, J., and Schwartzbach, M. I.Object-oriented Type Systems. John Wiley & Sons, 1994.
Reddy, U.S. Objects as closures: Abstract semantics of object oriented languages. In Proc. Conference on Lisp and Functional Programming July 1988, pp. 289–297.
Rémy, D. Programming objects with ML-ART: An extension to ML with abstract and record types. In Theoretical Aspects of Computer Software (New York, N.Y., Apr. 1994, M. Hagiya and J. C. Mitchell, Eds., Lecture Notes in Computer Science 789, Springer-Verlag, pp. 321–346.
Rossie, J. G., Friedman, D.P., and Wand, M. Modeling subobject-based inheritance. In Proc. European Conference on Object-Oriented Programming (Berlin, Heidelberg, and New York, July 1996), P Cointe, Ed., Lecture Notes in Computer Science 1098, Springer-Verlag, pp. 248–274.
Snyder, A. Inheritance and the development of encapsulated software components. In Research Directions in Object-Oriented Programming. MIT Press, 1987, pp. 165–188.
Syme, D. Proving Java type soundness. Tech. Rep. 427, University of Cambridge, July 1997.
Wright, A., and Felleisen, M. A syntactic approach to type soundness. Tech. Rep. 160, Rice University, 1991. Information and Computation, volume 115(1), 1994, pp. 38–94.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1999 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Flatt, M., Krishnamurthi, S., Felleisen, M. (1999). A Programmer’s Reduction Semantics for Classes and Mixins. In: Alves-Foss, J. (eds) Formal Syntax and Semantics of Java. Lecture Notes in Computer Science, vol 1523. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-48737-9_7
Download citation
DOI: https://doi.org/10.1007/3-540-48737-9_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-66158-0
Online ISBN: 978-3-540-48737-1
eBook Packages: Springer Book Archive