Abstract
Nominal and structural subtyping each have their own strengths and weaknesses. Nominal subtyping allows programmers to explicitly express design intent, and, when types are associated with run time tags, enables run-time type tests and external method dispatch. On the other hand, structural subtyping is flexible and compositional, allowing unanticipated reuse. To date, nearly all object-oriented languages fully support one subtyping paradigm or the other.
In this paper, we describe a core calculus for a language that integrates the key aspects of nominal and structural subtyping in a unified framework. We have also merged the flexibility of structural subtyping with statically typechecked external methods, a novel combination. We prove type safety for this language and illustrate its practical utility through examples that are not easily expressed in other languages. Our work provides a clean foundation for the design of future languages that enjoy the benefits of both nominal and structural subtyping.
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
Bono, V., Damiani, F., Giachino, E.: Separating Type, Behavior, and State to Achieve Very Fine-grained Reuse. In: Electronic proceedings of FTfJP (2007), http://www.cs.ru.nl/ftfjp/
Bracha, G., Cook, W.: Mixin-based inheritance. In: ECOOP 1990(1990)
Bracha, G., Griswold, D.: Strongtalk: typechecking Smalltalk in a production environment. In: OOPSLA 1993, pp. 215–230 (1993)
Bruce, K.B., Schuett, A., Gent, R.V., Fiech, A.: PolyTOIL: A type-safe polymorphic object-oriented language. ACM Trans. Program. Lang. Syst. 25(2), 225–290 (2003)
Castagna, G., Ghelli, G., Longo, G.: A calculus for overloaded functions with subtyping. Inf. Comput. 117(1), 115–135 (1995)
Chambers, C.: Object-oriented multi-methods in Cecil. In: Lehrmann Madsen, O. (ed.) ECOOP 1992. LNCS, vol. 615. Springer, Heidelberg (1992)
Chambers, C.: Cecil Group. The Cecil language: specification and rationale, version 3.2 (February 2004), http://www.cs.washington.edu/research/projects/cecil/
Clifton, C., Millstein, T., Leavens, G.T., Chambers, C.: MultiJava: Design rationale, compiler implementation, and applications. ACM Trans. Program. Lang. Syst. 28(3), 517–575 (2006)
Davies, R., Pfenning, F.: Intersection types and computational effects. In: ICFP 2000, pp. 198–208 (2000)
Fisher, K., Reppy, J.: The design of a class mechanism for Moby. In: PLDI 1999, pp. 37–49 (1999)
Fisher, K., Reppy, J.: Inheritance-based subtyping. Inf. Comput. 177(1), 28–55 (2002)
Gil, J., Maman, I.: Whiteoak (2008), http://ssdl-wiki.cs.technion.ac.il/wiki/index.php/Whiteoak
Gregor, D., Järvi, J., Siek, J., Stroustrup, B., Reis, G.D., Lumsdaine, A.: Concepts: Linguistic support for generic programming in C++. In: Proceedings of OOPSLA 2006, October 2006, pp. 291–310. ACM Press, New York (2006)
Leroy, X., Doligez, D., Garrigue, J., Rémy, D., Vouillon, J.: The Objective Caml system, release 3.09 (2004), http://caml.inria.fr/pub/docs/manual-ocaml/index.html
Madsen, O.L., Moller-Pedersen, B.: Virtual classes: a powerful mechanism in object-oriented programming. In: OOPSLA 1989, pp. 397–406 (1989)
Malayeri, D., Aldrich, J.: Combining structural subtyping and external dispatch. In: FOOL/WOOD 2007 (January 2007), http://foolwood07.cs.uchicago.edu/program.html
Malayeri, D., Aldrich, J.: Integrating Nominal and Structural Subtyping. Technical Report CMU-CS-08-120, School of Computer Science, Carnegie Mellon University (May 2008)
Sun Microsystems. Java collections API design FAQ (2003), http://java.sun.com/j2se/1.4.2/docs/guide/collections/designfaq.html
Millstein, T.D., Chambers, C.: Modular statically typed multimethods. Inf. Comput. 175(1), 76–118 (2002)
Nelson, G. (ed.): Systems programming with Modula-3. Prentice-Hall, Inc., Upper Saddle River (1991)
Nystrom, N., Chong, S., Myers, A.C.: Scalable extensibility via nested inheritance. In: OOPSLA 2004, pp. 99–115 (2004)
Odersky, M.: The Scala language specification (2007), http://www.scala-lang.org/docu/files/ScalaReference.pdf
Ostermann, K.: Nominal and Structural Subtyping in Component-Based Programming. Journal of Object Technology 7(1) (2008)
Reppy, J., Turon, A.: Metaprogramming with traits. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609. Springer, Heidelberg (2007)
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)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Malayeri, D., Aldrich, J. (2008). Integrating Nominal and Structural Subtyping. In: Vitek, J. (eds) ECOOP 2008 – Object-Oriented Programming. ECOOP 2008. Lecture Notes in Computer Science, vol 5142. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-70592-5_12
Download citation
DOI: https://doi.org/10.1007/978-3-540-70592-5_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-70591-8
Online ISBN: 978-3-540-70592-5
eBook Packages: Computer ScienceComputer Science (R0)