ECOOP Tutorial
ECOOP Tutorial
Title:
Typing in object-oriented languages:
Achieving expressiveness and safety
Presenter:
Kim B. Bruce, Frederick Latimer Wells Professor of Computer Science,
Williams College, Williamstown, MA 01267, USA.
Abstract:
Static typing can assist in earlier error detection, provide
assistance to the compiler in making optimization, and provide important
information to programmer as to how different constructs are intended to
be used. However, the simple static-typing disciplines for object-oriented
languages like C++, Object Pascal, and Modula-3 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 tutorial begins with 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'' (a form of bounded polymorphism)
into these type systems. We include a brief discussion on how the type
system and semantics ensure type safety.
The tutorial will also include a discussion of how these
constructs could be added to existing languages like Java in
order to enhance their expressiveness with little or no impact on run-time
performance.
Outline:
- Types in OO languages
- Types as interfaces
- Should classes be types in OOL's?
- Static vs. dynamic typing
- Review of fundamental concepts of OOL's
- Subtypes
- Record types
- Function types
- Variable types
- Subclasses
- Limitations of simple type systems (e.g., Object Pascal, C++)
via examples
- Clone methods
- Classes with object components
- Binary methods
- Loosening rules too much: the Eiffel case.
- Loosening restrictions on types of methods in subclasses
- Allow method types to be subtypes in subclasses
- Instance variables can't change
- Still not flexible enough
- MyType and Matching
- MyType solves Clone and binary method problems
- Requires more care in type-checking: matching
- Subclass is not subtype
- Subtyping for object types with MyType
- Constrained Genericity
- Subtyping does not provide useful constraint for polymorphism
- Matching works well (examples)
- Using constrained genericity to replace covariant typing
- Revealing what is under the hood: Type checking and Semantics
- Formalizing type rules
- Formalizing natural (operational) semantics
- Type safety
- Reducing complexity
- Throw out subtyping in favor of matching
- Introduce #-types to handle heterogeneous types
- Result is significantly simpler language
- Disadvantages
- Planning ahead
- Binary methods restricted to non-#-types.
- Modules & information hiding using matching
- Comparison with type systems of existing languages
- Object Pascal, C++, Modula-3
- Eiffel
- Ada 95
- Adding MyType and bounded matching to Java & other OOL's
- Design trade-offs
- Sample programs
- Summary and future outlook
Duration:
Half day
Level:
Advanced to intermediate
Required experience:
Familiarity with and experience using
class-based object-oriented programming languages. Experience with static
typing systems.
Expected Audience:
Programmers who would like the flexibility
of weakly or dynamically typed languages, but the error detection and
efficiency of statically-typed languages. This should be of interest
to language designers as well as others who would like to see the applications
of type theory to language design.
Presenter's profile:
Kim Bruce is Wells Professor of Computer Science at
Williams College in Massachusetts, USA. He received his B.A. from Pomona
College and Ph.D. from the University of Wisconsin. He taught at Princeton
University before coming to Williams, and has been a visiting professor or
scientist at M.I.T., Stanford, Ecole Normale Superieure, the University of
Pisa, and the Newton Institute for Mathematical Sciences at Cambridge
University. He has worked on the semantics of object-oriented languages for
the last 10 years, and provably-safe type systems for object-oriented languages
for the last 5 years. He has served on the OOPSLA program committee, and has
been co-organizer of workshops on the Foundations of Object-Oriented Languages
in 1993, 1994, and 1996. He has presented papers at the ECOOP, OOPSLA, POPL,
MFPS, and LICS conferences, and currently serves on the editorial boards for
TAPOS and the forthcoming CRC Handbook of Computer Science and Engineering.
My vita, some of my papers, and other information is available through
my home page.
Note:
Some of the material in this tutorial will be based on
my recently completed paper, "Typing in object-oriented languages:
Achieving expressiveness and safety," which has been accepted for publication
in Computer Surveys.
kim@cs.williams.edu