LISP and Symbolic Computation, 8(4)343-355
Simple Imperative Polymorphism
Andrew K. Wright, Department of Computer Science, Rice University, Houston, TX 77251-1892
Abstract: This paper describes a simple extension of the
Hindley-Milner polymorphic type discipline to call-by-value languages
that incorporate imperative features like references, exceptions, and
continuations. This extension sacrifices the ability to type every
purely functional expression that is typable in the Hindley-Milner
system. In return, it assigns the same type to functional and
imperative implementations of the same abstraction. Hence with a
module system that separates specifications from implementations,
imperative features can be freely used to implement polymorphic
specifications. A study of a number of ML programs shows that the
inability to type all Hindley-Milner typable expressions seldom
impacts realistic programs. Furthermore, most programs that are
rendered untypable by the new system can be easily repaired.
Keywords: continuations, functional programming, polymorphism,
references, state
|
[local copy]
|
|