Traditionally ``objects'' in high-level languages such as ML and Haskell have been viewed as closures (records of functions). A new model of objects for these languages is presented, and it is shown how its addition significantly increases the expressiveness of these languages. In particular the new model provides first-class objects with polymorphic methods, previously considered impossible in ML-like languages. The type system thus admits first-class polymorphism while retaining the simple stratified polymorphism of ML-like languages. Rather than reducing objects to records of functions, records are reduced to simple objects; the traditional view of objects-as-closures is thus a special (and limited) case in this object model. A type inference algorithm is provided for the resulting calculus; correctness of the algorithm is formulated modulo some global restrictions which obviate the need for constrained type variables. An efficient algorithm for solving subtyping constraints is developed in a separate paper. An operational semantics is provided, and a subject reduction property verified for the semantics. The operational semantics is the basis for a partial equivalence relation model of types. The calculus is shown to be an extension of Harper and Mitchell's XML, the former retaining the stratified polymorphism of the latter. Connections are made with related work on dynamic typing mechanisms for polymorphic languages.
The paper is available on the WWW . The page contains links to these ftp URLs, where it can be retrieved from as file polymorphic-methods.ps.gz (and should then be uncompressed with gunzip):
As mentioned in the abstract, the paper has some relationship to another paper announced in January, "Dynamic Types Have Existential Type." This paper has recently been revised. It is available from the sites listed above, as file dynamic-types.ps.gz .
Comments on either paper are welcome.