: Tuesday
Associated Types and Constraint Propagation for Mainstream Object-Oriented Generics
San Diego Room
Tuesday, 10:30, 30 minutes
| 7 | · | 8 | · | 9 | · | 10 | · | 11 | · | 12 | · | 13 | · | 14 | · | 15 | · | 16 | · | 17 | · | 18 | · | 19 | · | 20 | · | 21 |
Jaakko Järvi, Texas A&M University
Jeremiah Willcock, Indiana University
Andrew Lumsdaine, Indiana University
Support for object-oriented programming has become an integral part of mainstream languages, and more recently generic programming has gained widespread acceptance as well. A natural question is how these two paradigms, and their underlying language mechanisms, should interact. One particular design option, that of using subtyping to constrain the type parameters of generic functions, has been chosen for the generics extensions to Java and C#. Certain shortcomings have previously been identified in using subtyping for constraining parametric polymorphism in the context of generic programming. To address these, we propose the expansion of object-oriented interfaces and subtyping to include associated types and constraint propagation. Associated types are type members of interfaces and classes. Constraint propagation allows certain constraints on type parameters to be inferred from other constraints on those parameters and their use in base class type expressions. The paper demonstrates these extensions in the context of Generic C# and presents a formalism proving their safety. The formalism is applicable to other mainstream OO languages supporting F-bounded polymorphism, such as Java.