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.
Partially supported by Murst - Tecniche formali per la specifica, l’analisi, la verifica, la sintesi e la trasformazione di sistemi software
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
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.
D. Ancona and E. Zucca. A theory of mixin modules: basic and derived operators. Mathematical Structures in Computer Science, 8(4):401–446, 1998.
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.
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.
G. Bracha. The Programming Language JIGSAW: Mixins, Modularity and Multiple Inheritance. PhD thesis, Department of Comp. Sci., Univ. of Utah, 1992.
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.
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.
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.
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/
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.
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.
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.
M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. In ACM Symp. on Principles of Programming Languages 1998, pages 171–183, January 1998.
James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison-Wesley, 1996.
S.C. Keene. Object Oriented Programming in Common Lisp: A Programming Guide in CLOS. Addison-Wesley, 1989.
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.
D.A. Moon. Object oriented programming with Flavors. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1986, pages 1–8, 1986.
M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In ACM Symp. on Principles of Programming Languages 1997. January 1997.
A. Snyder. CommonObjects: An overview. SIGPLAN Notices, 21(10):19–28, 1986.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Ancona, D., Lagorio, G., Zucca, E. (2000). Jam - A Smooth Extension of Java with Mixins. In: Bertino, E. (eds) ECOOP 2000 — Object-Oriented Programming. ECOOP 2000. Lecture Notes in Computer Science, vol 1850. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45102-1_8
Download citation
DOI: https://doi.org/10.1007/3-540-45102-1_8
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67660-7
Online ISBN: 978-3-540-45102-0
eBook Packages: Springer Book Archive