Full-Fledged Generics for Object-Oriented Programming Languages

   page       BibTeX_logo.png       attach   

The recent development of high-level constructs for object-oriented languages is witnessing renewed interest in the design, implementation, and applications of the programming mechanism known as generics, also called parametric polymorphism. 

First, Sun Microsystems started a project aimed at adding generics to the Java programming language, which is ultimately leading to a new official version of the language. This is based on Bracha, Stoutamire, Odersky, and Wadler’s prototype called GJ, a language based on F-bounded polymorphism and implemented by a translation technique called type-erasure. Later, Microsoft Research has also developed a prototype for an extension of C# programming language and its Common Language Runtime, featuring similar language constructs. 

In this scenario, where genericity will soon become a fundamental issue in modern object-oriented programming languages, improvements to its design and implementation are going to play a crucial role in settling this programming construct into the mainstream of software development. So, the goal of this thesis is to overview the main aspects of genericity in modern languages, and to propose new and improved solutions, both at the design and at the implementation level. 

In particular, the contribution to this field are focused on two main areas. On the one hand, a new implementation schema for generics, called Ego (Exact Generics On-demand), is developed by extending GJ translation technique. Full run-time support to generic types is added, enabling integration of generics with persistence and reflection mechanisms, while retaining full compatibility with respect to the legacy code and to the existing Java Virtual Machines (JVMs). On the other hand, this thesis also studies the design of generics from the viewpoint of their linguistic aspects, by introducing the typing mechanism of variant parametric types. This is meant to enhance synergy between parametric polymorphism – introduced by generics – and inclusive polymorphism – supported by subtyping and inheritance –, promoting a further level of code expressiveness, reuse, and safety. 

The solutions here proposed for the design and implementation of generics are shown to provide useful means for extending the applicability and effectiveness of the generics paradigm in modern mainstream object-oriented languages such as Java and C#.

keywordsImplementation of Programming Languages, Object-Oriented Programming Languages, Type Systems, Parametric Polymorphism