[L7] ================================================ AMAST Links 02 08 Typing in object-oriented languages: Achieving expressibility and safety Kim B. Bruce Williams College While simple static-typing disciplines exist for object-oriented languages like C++, Object Pascal, and Modula-3, they are often so restrictive that programmers are forced to by-pass 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. This paper consists of a survey of problems (illustrated by a series of sample programs) with existing type systems, and suggests ways of improving the expressibility of these systems while retaining static type safety. In particular we will discuss the motivations behind introducing "MyType", "matching", and "bounded matching" into these type systems. We also suggest a way of simplifying the resulting type system by replacing subtyping by a type system with a new type construct based on matching. Both systems provide support for binary methods, which are often difficult to support in statically-typed languages. The intent is to avoid pages of type-checking rules and formal proofs, but instead explain why the problems are interesting via the series of sample programs. The technical details (including proofs of subject reduction and type safety) are available elsewhere. The paper is available by following links from my _home page_ URL: http://www.cs.williams.edu/~kim/ or by anonymous ftp from URL: ftp://cs.williams.edu/pub/kim/ as file Static.{dvi,ps}. Comments are welcomed. (An earlier draft version of this paper available on the net was entitled: "Problems with static typing in object-oriented languages". Please discard any copies of the earlier version.)