Simple imperative polymorphism

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.

[1]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[2]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[3]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[4]  Luís Damas Type assignment in programming languages , 1984 .

[5]  Atsushi Ohori,et al.  A simple semantics for ML polymorphism , 1989, FPCA.

[6]  Robin Milner,et al.  Definition of standard ML , 1990 .

[7]  Robin Milner,et al.  Commentary on standard ML , 1990 .

[8]  Mads Tofte,et al.  Type Inference for Polymorphic References , 1990, Inf. Comput..

[9]  Xavier Leroy,et al.  Polymorphic type inference and assignment , 1991, POPL '91.

[10]  Robert Harper,et al.  Typing first-class continuations in ML , 1991, POPL '91.

[11]  X. Leroy Typage polymorphe d'un langage algorithmique , 1992 .

[12]  Andrew K. Wright Typing References by Effect Inference , 1992, ESOP.

[13]  John H. Reppy,et al.  Higher-Order Concurrency , 1992 .

[14]  Mark Lillibridge,et al.  Explicit polymorphism and CPS conversion , 1993, POPL '93.

[15]  Ramesh Viswanathan,et al.  Standard ML-NJ weak polymorphism and imperative constructs , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[16]  Xavier Leroy,et al.  Polymorphism by name for references and continuations , 1993, POPL '93.

[17]  John Greiner,et al.  Standard ML Weak Polymorphism Can Be Sound , 1993 .

[18]  Pierre Jouvelot,et al.  The Type and Effect Discipline , 1994, Inf. Comput..

[19]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..