CMU-CS-99-142
Computer Science Department
School of Computer Science, Carnegie Mellon University



CMU-CS-99-142

Respectful Type Converters For Mutable Types

Jeannette M. Wing and John Ockerbloom

June 1999

Submitted to Volume on Foundations of Component Based Systems,
edited by Gary Leavens and Murali Sitaraman

CMU-CS-99-142.ps
CMU-CS-99-142.pdf

Keywords: Type converters, mutable types, subtype, object-oriented design, abstraction function, specifications, semantics, Larch, TOM, Y2K


In converting an object of one type to another, we expect some of the original object's behavior to remain the same, and some to change. How can we state the relationship between the original object and converted object to characterize what information is preserved and what is lost after the conversion takes place? We answer this question by introducing the new relation, respects, and say that a type converter function K: A -> B respects a type T. We formally define respects in terms of the Liskov and Wing behavioral notion of subtyping; types A and B are subtypes of T.

In previous work we defined respects for immutable types A, B, and T; in this paper we extend our notion to handle conversions between mutable types. This extension is non-trivial since we need to consider an object's behavior as it varies over time. We present in detail two examples to illustrate our ideas: one for converting between PNG images and GIF images and another for converting between different kinds of bounded event queues. We also discuss in less detail other real-world applications, namely those inspired by our Typed Object Model (TOM) conversion service built at Carnegie Mellon and by the infamous Year 2000 (Y2K) problem.

30 pages


Return to: SCS Technical Report Collection
School of Computer Science homepage

This page maintained by [email protected]