Static typing aids in earlier error detection, supports compiler optimizations, and provides information to programmers on the intended use of constructs. However, simple static-typing disciplines for object-oriented languages like C++ and Java are so restrictive that programmers are forced to bypass the type system with type casts. Other languages allow more freedom, but require run-time checking to pick up the type errors that their more permissive systems missed.
After surveying problems with existing type systems (illustrated by a series of sample programs), we explain contravariance and covariance issues in type systems, and suggest ways of improving the expressiveness of these systems while retaining static type safety. Constructs introduced include "MyType," "matching," and "F-bounded polymorphism." We include a brief discussion on how the type system and semantics ensure type safety. We apply the concepts in the tutorial to compare the strengths and weaknesses of proposals to extend Java to support genericity based on F-bounded polymorphism, "where" clauses, match-bounded polymorphism, and virtual types. In particular, we cover the advantages and disadvantages of the forthcoming extensions to Java (taken from GJ) to support parametric polymorphism.
Prerequisites: Attendees should be very comfortable with a class-based object-oriented programming languages. Ideally, the attendee should have sufficient experience with type systems as to be frustrated with their limitations.
Kim Bruce is Wells Professor of Computer Science at Williams College. He received his Ph.D. from the University of Wisconsin and has been a visiting professor or scientist at M.I.T., Stanford, and Princeton, among others. A researcher on the types and semantics of object-oriented languages, he has served twice on the OOPSLA program committee, on the program committee of POPL '03, and as chair of the organizing committee of the FOOL workshops on the Foundations of Object-Oriented Languages for many years. He has presented papers at the ECOOP, OOPSLA, and POPL conferences, and is the author of the book, "Foundations of Object-Oriented Languages: Types and Semantics," MIT Press, 2002.