Institute for Software Research International
School of Computer Science, Carnegie Mellon University


A Type Checked Prototype-based Model with Linearity

Andi Bejleri, Jonathan Aldrich, Kevin Bierhoff

December 2004

Keywords: Change code dynamically, prototype-based languages, Self, static type checker, type safety

Dynamic inheritance, originating in the Self programming language, is the ability of an object to change the code that it inherits at run time. This ability is useful for modeling objects that behave in different ways at different points in the object's lifecycle. Unstructured dynamic inheritance, however, allows arbitrary changes to the interface of the object, and thus is incompatible with statically typechecked languages such as C++, C\# and Java.

This paper provides a more structured facility for dynamic inheritance, where a type system tracks the changes in an object's interface that occur as the inheritance hierarchy is changed. We define a formal model of a language and type system with dynamic inheritance, and prove that the type system is sound in that it prevents run-time type errors. The type system tracks the linearity of objects and methods in order to ensure that objects whose interfaces change are not aliased.

24 pages

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

This page maintained by