Jam - A Smooth Extension of Java with Mixins

  • Davide Ancona
  • Giovanni Lagorio
  • Elena Zucca
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1850)

Abstract

In this paper we present Jam, an extension of the Java language supporting mixins, that is, parametric heir classes. A mixin declaration in Jam is similar to a Java heir class declaration, except that it does not extend a fixed parent class, but simply specifies the set of fields and methods a generic parent should provide. In this way, the same mixin can be instantiated on many parent classes, producing different heirs, thus avoiding code duplication and largely improving modularity and reuse. Moreover, as happens for classes and interfaces, mixin names are reference types, and all the classes obtained instantiating the same mixin are considered subtypes of the corresponding type, hence can be handled in a uniform way through the common interface. This possibility allows a programming style where different ingredients are “mixed” together in defining a class; this paradigm is somehow similar to that based on multiple inheritance, but avoids the associated complications.

The language has been designed with the main objective in mind to obtain, rather than a new theoretical language, a working and smooth extension of Java. That means, on the design side, that we have faced the challenging problem of integrating the Java overall principles and complex type system with this new notion; on the implementation side, that we have developed a Jam to Java translator which makes Jam sources executable on every Java Virtual Machine.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    D. Ancona, G. Lagorio, and E. Zucca. Jam-A smooth extension of Java with mixins. Technical report, DISI-TR-99-15, University of Genova, November 1999. Available at http://www.disi.unige.it/ftp/person/AnconaD/Jam.ps.gz.
  2. 2.
    D. Ancona and E. Zucca. A theory of mixin modules: basic and derived operators. Mathematical Structures in Computer Science, 8(4):401–446, 1998.MATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    D. Ancona and E. Zucca. A primitive calculus for module systems. In G. Nadathur, editor, Principles and Practice of Declarative Programming, 1999, Lecture Notes in Computer Science, pages 62–79. Springer Verlag, 1999.CrossRefGoogle Scholar
  4. 4.
    G. Banavar and G. Lindstrom. An application framework for module composition tools. In ECOOP’ 96, number 1098 in Lecture Notes in Computer Science, pages 91–113. Springer Verlag, July 1996.Google Scholar
  5. 5.
    G. Bracha. The Programming Language JIGSAW: Mixins, Modularity and Multiple Inheritance. PhD thesis, Department of Comp. Sci., Univ. of Utah, 1992.Google Scholar
  6. 6.
    G. Bracha and W. Cook. Mixin-based inheritance. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1990, pages 303–311. ACM Press, October 1990. SIGPLAN Notices, volume 25, number 10.Google Scholar
  7. 7.
    G. Bracha and D. Griswold. Extending Smalltalk with mixins. In OOPSLA96 Workshop on Extending the Smalltalk Language, April 1996. Electronic note available at http://www.javasoft.com/people/gbracha/mwp.html.
  8. 8.
    G. Bracha and G. Lindstrom. Modularity meets inheritance. In Proc. International Conference on Computer Languages, pages 282–290, San Francisco, April 1992. IEEE Computer Society.Google Scholar
  9. 9.
    G. Bracha, M. Odersky, D. Stoutmire, and P. Wadler. Making the future safe for the past: Adding genericity to the Java programming language. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1998, October 1998. Home page: http://www.cs.bell-labs.com/who/wadler/pizza/gj/
  10. 10.
    S. Drossopoulou and S. Eisenbach. Describing the semantics of Java and proving type soundness. In J. Alves-Foss, editor, Formal Syntax and Semantics of Java, number 1523 in Lecture Notes in Computer Science, pages 41–82. Springer Verlag, Berlin, 1999.CrossRefGoogle Scholar
  11. 11.
    S. Drossopoulou, T. Valkevych, and S. Eisenbach. Java type soundness revisited. Technical report, Dept. of Computing-Imperial College of Science, Technology and Medicine, October 1999.Google Scholar
  12. 12.
    D. Duggan and C. Sourelis. Mixin modules. In Intl. Conf. on Functional Programming, pages 262–273, Philadelphia, June 1996. ACM Press. SIGPLAN Notices, volume 31, number 6.Google Scholar
  13. 13.
    M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. In ACM Symp. on Principles of Programming Languages 1998, pages 171–183, January 1998.Google Scholar
  14. 14.
    James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison-Wesley, 1996.Google Scholar
  15. 15.
    S.C. Keene. Object Oriented Programming in Common Lisp: A Programming Guide in CLOS. Addison-Wesley, 1989.Google Scholar
  16. 16.
    A.C. Meyers, J.A. Bank, and B. Liskov. Parameterized types for Java. In Proc. 24th ACM Symp. on Principles of Programming Languages. ACM Press, January 1997.Google Scholar
  17. 17.
    D.A. Moon. Object oriented programming with Flavors. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1986, pages 1–8, 1986.Google Scholar
  18. 18.
    M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In ACM Symp. on Principles of Programming Languages 1997. January 1997.Google Scholar
  19. 19.
    A. Snyder. CommonObjects: An overview. SIGPLAN Notices, 21(10):19–28, 1986.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Davide Ancona
    • 1
  • Giovanni Lagorio
    • 1
  • Elena Zucca
    • 1
  1. 1.Dipartimento di Informatica e Scienze dell’InformazioneGenovaItaly

Personalised recommendations