Skip to main content

A Programmer’s Reduction Semantics for Classes and Mixins

  • Chapter
  • First Online:
Formal Syntax and Semantics of Java

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1523))

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

    an intuitive model of an essential Java subset;

  2. 2.

    an extension that explains and models mixins; and

  3. 3.

    type soundness theorems for these languages.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

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

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  5. Bracha, G. The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. Ph.D. thesis, Dept. of Computer Science, University of Utah, Mar. 1992.

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  8. Cook, W. R.A Denotational Semantics of Inheritance. Ph.D. thesis, Department of Computer Science, Brown University, Providence, RI, May 1989.

    Google Scholar 

  9. Drossopolou, S., and Eisenbach, S. Java is typesafe-probably. In Proc. European Conference on Object Oriented Programming June 1997.

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  12. Felleisen, M. Programming languages and lambda calculi. URL: www.cs.rice.edu/~matthias/411web/mono.ps.

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

    Google Scholar 

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

    Google Scholar 

  15. Flatt, M. PLT MzScheme: Language manual. Tech. Rep. TR97-280, Rice University, 1997.

    Google Scholar 

  16. Gamma, E., Helm, R., Johnson, R., and Vlissides, J.Design Patterns: Elements of Reusable Object-Oriented Software. AddisonWesley, Massachusetts, 1994.

    Google Scholar 

  17. Gosling, J., Joy, B., and Steele, G.The Java Language Specification. The Java Series. Addison-Wesley, Reading, MA, USA, June 1996.

    MATH  Google Scholar 

  18. Harper, R., and Stone, C. A type-theoretic semantics for Standard ML 1996. Submitted for publication, 1997.

    Google Scholar 

  19. Kamin, S. Inheritance in SMALLTALK-80: a denotational definition. In Proc. ACM Symposium on Principles of Programming Languages Jan. 1988.

    Google Scholar 

  20. Kessler, R.R.LISP, Objects, and Symbolic Programming. Scott, Foresman and Company, Glenview, IL, USA, 1988.

    Google Scholar 

  21. Koschmann, T.The Common LISP Companion. John Wiley and Sons, New York, N.Y., 1990.

    MATH  Google Scholar 

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

    Google Scholar 

  23. Palsberg, J., and Schwartzbach, M. I.Object-oriented Type Systems. John Wiley & Sons, 1994.

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  27. Snyder, A. Inheritance and the development of encapsulated software components. In Research Directions in Object-Oriented Programming. MIT Press, 1987, pp. 165–188.

    Google Scholar 

  28. Syme, D. Proving Java type soundness. Tech. Rep. 427, University of Cambridge, July 1997.

    Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics