Abstract
Traits support the factoring out of common behaviour, and its integration into classes in a manner that coexists smoothly with inheritance-based structuring mechanisms.
We designed the language Chai, which incorporates statically typed traits into a simple Java-inspired base language, and we discuss three versions of the language: Chai 1, where traits are only a mechanism for the creation of classes; Chai 2 where traits are a mechanism for the creation of classes, and can also introduce types, and Chai 3 where traits play a role at runtime, and can can be applied to objects, and change the objects’ behaviour. We give formal models for these languages, outline the proof of soundness, and our prototype implementation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Agesen, O., Bak, L., Chambers, C., Chang, B.-W., Hölzle, U., Maloney, J., Smith, R.B., Ungar, D.: The Self 4.0 Programmer’s Reference Manual. Sun Microsystems, Inc (1995)
Ancona, D., Lagorio, G., Zucca, E.: Jam - A Smooth Extension of Java with Mixins. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 154–178. Springer, Heidelberg (2000)
Black, A., Schärli, N., Ducasse, S.: Applying Traits to the Smalltalk Collection Hierarchy. In: ACM Conference on Object Oriented Systems, Languages and Applications (OOPSLA), October 2003, pp. 47–64 (2003)
Bracha, G.: The programming language jigsaw: mixins, modularity and multiple inheritance. PhD thesis, University of Utah (1992)
Bracha, G., Cook, W.: Mixin-Based Inheritance. In: Meyrowitz, N. (ed.) Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications / Proceedings of the European Conference on Object-Oriented Programming, Ottawa, Canada, pp. 303–311. ACM Press, New York (1990)
Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the Future Safe for the Past: Adding Genericity to the Java Programming Language. In: Chambers, C. (ed.) ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), Vancouver, BC, pp. 183–200 (1998)
Drossopoulou, S., Damiani, F., Dezani-Ciancaglini, M., Giannini, P.: Fickle: Dynamic object re-classification. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 130–149. Springer, Heidelberg (2001)
Ducasse, S., Nierstrasz, O., Schärli, N., Wuyts, R.: Traits - Composable Units of Behaviour. University of Berne, Software Composition Group, http://www.iam.unibe.ch/~scg/Research/Traits/index.html
Ernst, E.: Family Polymorphism. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 303–326. Springer, Heidelberg (2001)
Fisher, K., Reppy, J.: Statically Typed Traits. Technical Report TR-2003-13, Department of Computer Science, University of Chicago, December 2003. presented at FOOL (January 2004)
Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and Mixins. In: Conference Record of POPL 1998: The 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Diego, California, New York, pp. 171–183 (1998)
Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. In: Meissner, L. (ed.) Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA 1999), N.Y, vol. 34(10), pp. 132–146 (1999)
Liquori, L., Spiwack, A.: Featherweight-Trait Java, A Trait-based Extension for FJ (2004), http://www-sop.inria.fr/mirho/Luigi.Liquori/PAPERS/ftj.ps.gz
Meyer, B.: Eiffel: the Language. Prentice-Hall, Englewood Cliffs (1988)
Odersky, M., Altherr, P., Cremet, V., Emir, B., Micheloud, S., Mihaylov, N., Schinz, M., Stenman, E., Zenge, M.: The Scala Language Specification Version 1.0. Technical report, Programming Methods Laboratory, EPFL, Switzerland (2004)
Odersky, M., Cremet, V., Röckl, C., Zenger, M.: A Nominal Theory of Objects with Dependent Types. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743. Springer, Heidelberg (2003)
Quitslund, P.J., Black, A.P.: Java with Traits — Improving Opportunities for Reuse. In: Malenfant, J., Østvold, B.M. (eds.) ECOOP 2004. LNCS, vol. 3344. Springer, Heidelberg (2005)
Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.: Traits: Composable Units of Behavior. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743. Springer, Heidelberg (2003)
Schärli, N., Nierstrasz, O., Ducasse, S., Wuyts, R., Black, A.: Traits: The Formal Model. Technical Report IAM-02-006, Institut für Informatik, Universität Bern, Switzerland (November 2002)
Smith, C.: Typed Traits, September. MSc thesis - Department of Computing. Imperial College, London (September 2004), http://chai-t.sourceforge.net/
Stroustrup, B.: Multiple inheritance for C++. In: Proceedings of the Spring 1987 European Unix Users Group Conference, Helsinki (1987)
Ungar, D., Smith, R.B.: Self: The power of simplicity. In: Conference proceedings on Object-oriented programming systems, languages and applications, pp. 227–242. ACM Press, New York (1987)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Smith, C., Drossopoulou, S. (2005). Chai: Traits for Java-Like Languages. In: Black, A.P. (eds) ECOOP 2005 - Object-Oriented Programming. ECOOP 2005. Lecture Notes in Computer Science, vol 3586. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11531142_20
Download citation
DOI: https://doi.org/10.1007/11531142_20
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-27992-1
Online ISBN: 978-3-540-31725-8
eBook Packages: Computer ScienceComputer Science (R0)