Skip Navigation

Colloquium Details

Building Adaptable Programs in HOT Languages: A Comparison of Polymorphism, Modules, and Objects

Author:David McQueen Bell Labs Research
Date:May 11, 2000
Time:16:00
Location:220 Deschutes

Abstract

The adjective "HOT", meaning Higher-Order Typed, has been introduced to cover a broad class of programming languages characterized by their advanced type and module systems and by higher-order features like first-class functions or objects. The class of HOT languages includes functional languages such as ML and Haskell, as well as typed object-oriented languages like Java and Eiffel. The last twenty years has seen substantial progress in the foundations of HOT languages, and in the design of languages based on those foundations.

Beyond these usual benefits of a sound, static type system, HOT programming languages provide superior support for building flexible software; that is, programs and libraries that are easy to adapt or specialize for reuse in different contexts. There are two main approaches employed by HOT languages to provide this flexibility: various forms of parameterization (typical of functional languages), and subtyping and "open recursion" (characteristic of object-oriented languages). At the data level, flexibility and expressiveness are provided through two higher-order features: first-class functions and objects. Both are basically constructs for combining code and data, but they require rather different typing schemes, and give rise to very different programming idioms.

At the type level, functional languages have favored type abstraction (i.e. abstract data types), simple type parameterization (parametric polymorphism), and type parameterization with signatures (ML functors) or dictionaries (Haskell type classes), while object oriented languages use subtyping combined with implementation inheritance or related program construction schemes I will collectively characterize as "open recursion".

I'll discuss how these different approaches are used to support generic, adaptable libraries and frameworks. I'll also discuss the relative strengths and weaknesses of parameterization versus subtyping and inheritance, and mention some designs that attempt to unify the two paradigms (Generic Java, Ocaml, Moby).