Abstract
This paper presents a conceptually oriented updated view on the relationship between parametric types and virtual classes. The traditional view is that parametric types excel at structurally oriented composition and decomposition, and virtual classes excel at specifying mutually recursive families of classes whose relationships are preserved in derived families. Conversely, while class families can be specified using a large number of F-bounded type parameters, this approach is complex and fragile; and it is difficult to use traditional virtual classes to specify object composition in a structural manner, because virtual classes are closely tied to nominal typing. This paper adds new insight about the dichotomy between these two approaches; it illustrates how virtual constraints and type refinements, as recently introduced in gbeta and Scala, enable structural treatment of virtual types; finally, it shows how a novel kind of dynamic type check can detect compatibility among entire families of classes.
This work was supported by FTP 274-06-0029.
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
Agesen, O., Freund, S.N., Mitchell, J.C.: Adding type parameterization to the Java language. In: Proceedings of OOPSLA ’97, pp. 49–65 (1997)
Altherr, P.: A typed intermediate language and algorithms for compiling scala by successive rewritings. PhD thesis, EPFL (2006), http://library.epfl.ch/theses/?nr=3509
Aracic, I., Gasiunas, V., Mezini, M., Ostermann, K.: An overview of CaesarJ. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 135–173. Springer, Heidelberg (2006)
Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: adding genericity to the Java programming language. In: Proceedings of OOPSLA ’98, pp. 183–200 (1998)
Bruce, K.B., Odersky, M., Wadler, P.: A statically safe alternative to virtual types. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 523–549. Springer, Heidelberg (1998)
Canning, P., Cook, W., Hill, W., Olthoff, W.: F-bounded polymorphism for object-oriented programming. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture ’89, pp. 273–280 (1989)
Ernst, E.: gbeta – a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, Department of Computer Science, Aarhus University, Århus, Denmark (1999)
Ernst, E.: Propagating class and method combination. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 67–91. Springer, Heidelberg (1999)
Ernst, E.: Family polymorphism. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 303–326. Springer, Heidelberg (2001)
Ernst, E.: Higher-order hierarchies. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 303–329. Springer, Heidelberg (2003)
Ernst, E.: Reconciling virtual classes with genericity. In: Lightfoot, D.E., Szyperski, C. (eds.) JMLC 2006. LNCS, vol. 4228, pp. 57–72. Springer, Heidelberg (2006)
Ernst, E., Ostermann, K., Cook, W.R.: A virtual class calculus. In: Proceedings of POPL ’06, pp. 270–282 (2006)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (May 2005)
Herrmann, S.: Object teams: Improving modularity for crosscutting collaborations. In: Proceedings of Net. Object days, pp. 248–264 (2002)
Herrmann, S., Herrmann, S., Hundt, C., Hundt, C., Mehner, K., Mehner, K.: Translation polymorphism in object teams. Technical report, Technical University Berlin (2004)
Kennedy, A., Syme, D.: Design and implementation of generics for the.net common language runtime. SIGPLAN Not. 36(5), 1–12 (2001)
Madsen, O.L., Møller-Pedersen, B.: Virtual classes: A powerful mechanism in object-oriented programming. In: Proceedings of OOPSLA ’89, pp. 397–406 (1989)
Madsen, O.L., Nygaard, K., Møller-Pedersen, B.: Object-Oriented Programming in The Beta Programming Language. Addison-Wesley, Reading (1993)
Mezini, M., Ostermann, K.: Conquering aspects with Caesar. In: Proceedings of AOSD ’03, pp. 90–99 (2003)
Moors, A., Piessens, F., Odersky, M.: Generics of a higher kind. In: Proceedings of OOPSLA ’08, pp. 423–438 (2008)
Myers, A.C., Bank, J.A., Liskov, B.: Parameterized types for Java. In: Proceedings of POPL ’97, pp. 132–145 (1997)
Nielsen, A.B., Ernst, E.: Optimizing dynamic class composition in a statically typed language. In: Paige, R.F., Meyer, B. (eds.) TOOLS EUROPE 2008. LNBIP, vol. 11, pp. 161–177. Springer, Heidelberg (1974)
Nystrom, N., Chong, S., Myers, A.C.: Scalable extensibility via nested inheritance. In: OOPSLA ’04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 99–115 (2004)
Nystrom, N., Qi, X., Myers, A.C.: J&: nested intersection for scalable software composition. In: Proceedings of OOPSLA ’06, pp. 21–36 (2006)
Nystrom, N., Saraswat, V., Palsberg, J., Grothoff, C.: Constrained types for object-oriented languages. In: Proceedings of OOPSLA ’08, pp. 457–474 (2008)
Odersky, M.: The Scala Language Specification. EPFL, Version 2.7 edn. (March 2009)
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, pp. 201–224. Springer, Heidelberg (2003)
Odersky, M., Wadler, P.: Pizza into Java: translating theory into practice. In: Proceedings of POPL ’97, pp. 146–159 (1997)
Odersky, M., Zenger, M.: Independently extensible solutions to the expression problem. In: Proc. FOOL 12 (January 2005)
Qi, X., Myers, A.C.: Sharing classes between families. In: Proceedings of PLDI ’09, pp. 281–292 (2009)
Russo, C.V.: First-class structures for Standard ML. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 336–350. Springer, Heidelberg (2000)
Saito, C., Igarashi, A., Viroli, M.: Lightweight family polymorphism*. Journal of Functional Programming 18(3), 285–331 (2008)
Ullman, J.D.: Elements of ML programming (ML97 ed.). Prentice-Hall, Inc, Upper Saddle River (1998)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Madsen, A.B., Ernst, E. (2010). Revisiting Parametric Types and Virtual Classes. In: Vitek, J. (eds) Objects, Models, Components, Patterns. TOOLS 2010. Lecture Notes in Computer Science, vol 6141. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-13953-6_13
Download citation
DOI: https://doi.org/10.1007/978-3-642-13953-6_13
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-13952-9
Online ISBN: 978-3-642-13953-6
eBook Packages: Computer ScienceComputer Science (R0)