Tech Report CS-11-04

Fluid Object Types

Arjun Guha, Joe Gibbs Politz and Shriram Krishnamurthi

October 2011

Abstract:

Objects in popular scripting languages are lightweight and dynamic. Programmers use these objects in ways that confound existing type systems. We present a core calculus, LambdaS-Ob, that distills the essence of objects in a number of scripting languages. Using LambdaS-Ob, we examine characteristic object-oriented scripting idioms that are untypable by conventional type systems. We develop fluid object types, a novel generalization of structural object types. Fluid object types can specify the presence or absence of fields, their position in the inheritance chain, and employ string pattern types to describe (possibly infinite) collections of fields. We have implemented fluid object types in our experimental type-checker for JavaScript. We briefly report on our experience with our prototype.

(complete text in pdf)