## A theory of type polymorphism in programming (1978)

Venue: | Journal of Computer and System Sciences |

Citations: | 952 - 0 self |

### BibTeX

@ARTICLE{Milner78atheory,

author = {Robin Milner},

title = {A theory of type polymorphism in programming},

journal = {Journal of Computer and System Sciences},

year = {1978},

volume = {17},

pages = {348--375}

}

### Years of Citing Articles

### OpenURL

### Abstract

The aim of this work is largely a practical one. A widely employed style of programming, particularly in structure-processing languages which impose no discipline of types, entails defining procedures which work well on objects of a wide variety. We present a formal type discipline for such polymorphic procedures in the context of a simple pro-gramming language, and a compile time type-checking algorithm w which enforces the discipline. A Semantic Soundness Theorem (based on a formal semantics for the language) states that well-type programs cannot “go wrong ” and a Syntactic Soundness Theorem states that if fl accepts a program then it is well typed. We also discuss extending these results to richer languages; a type-checking algorithm based on w is in fact already implemented and working, for the metalanguage ML in the Edinburgh LCF system, 1.

### Citations

964 |
A machine-oriented logic based on the resolution principle
- Robinson
- 1965
(Show Context)
Citation Context ...ing the “principal type scheme” (which is what we call a polymorphic type) for a term in combinatory logic. Hindley appears to have been the first to notice that the Unification Algorithm of Robinson =-=[14]-=- is appropriate to this problem. Our work can be regarded as an extension of Hindley’s method to programming languages with local declarations, and as a semantic justification of the method. In summar... |

369 |
Towards a theory of type structure
- Reynolds
- 1974
(Show Context)
Citation Context ...n of our system, but that we may have kept as much flexibility as is possible without the use of explicit type parameters. When these are introduced, the problem arises of the type of types; Reynolds =-=[12]-=- has made some progress in solving this problem, but we were anxious to see how much could be done while avoiding it. 3.1. The Language Exp 3. A SIMPLE APPLICATIVE LANGUAGE AND ITS TYPES Let x range o... |

220 |
Data Types as Lattices
- Scott
- 1976
(Show Context)
Citation Context ... the identity function (hv E V . v) in Y for example has type p + p for every p. And of course Iv has every type (it is the only value which has every type). This notion of type is derived from Scott =-=[17]-=-. In fact, it is what Scott callsfunctionality (after Curry), and is distinct from the notion of a retract. If we temporarily identify a type with the set of values which possess it, then it is easy t... |

216 | A Powerdomain Construction
- Plotkin
- 1976
(Show Context)
Citation Context ...Inv(SR), c Spec($) U New, Vars(T) = Vars(U@ C IMu) u {PI, C Spec@) u New, 4.3. Implementation of w; a Simplified Algorithm $ by Proposition 6, from (9) and (1 l), by Proposition 6, again from (9) and =-=(11)-=-. 1 As it stands, ?Y is hardly an efficient algorithm; substitutions are applied too often. It was formulated to aid the proof of soundness. We now present a simpler algorithm f which simulates w in a... |

192 |
The next 700 programming languages
- Landin
- 1966
(Show Context)
Citation Context ...E We illustrate our notion of polymorphism by means of some simple examples. They are written in a fragment of ML which we hope is self-explanatory; this fragment is indeed no more than Landins ISWIM =-=[7]-=-, and we refer the reader to Burge’s book [l] insTYPE POLYMORPHISM 351 which he uses this style of programming almost exactly. We use no imperative constructs here (assignments or jumps). The construc... |

159 |
Fundamental concepts in programming languages. Unpublished lecture notes for
- Strachey
- 1967
(Show Context)
Citation Context ...e specified only as “procedure” (rather than say “integer to realprocedure”) -but the flexibility was not uniform, and not sufficient. An early discussion of such flexibility can be found in Strachey =-=[19]-=-, who was probably the first to call it polymorphism. In fact he qualified it as “parametric” polymorphism, in contrast to what he called “adhoc” polymorphism. An example of the latter is the use of “... |

147 |
The principal type-scheme of an object in combinatory logic
- Hindley
- 1969
(Show Context)
Citation Context ...ssignment may be found for a term of the Xcalculus by solving a set of simultaneous linear equations; we take this idea further in the next section. After doing this work we became aware of Hindley’s =-=[5]-=- method for deriving the “principal type scheme” (which is what we call a polymorphic type) for a term in combinatory logic. Hindley appears to have been the first to notice that the Unification Algor... |

135 |
Towards a mathematical semantics for computer languages
- Scott, Strachey
(Show Context)
Citation Context ...The semantic function is d E Exp + Env -+ V, where Env = Id -+ V, the domain of environments. We use 7 to range over Env. In defining 8, and later, we use some familiar notation of Scott and Strachey =-=[16]-=-, illustrated by these examples (where D is some summand of V): (i) If d E D, then d in V is the image of d under the injection of D into V. (ii) If v E V, then (iii) If v E V, then vED==true ifv =din... |

132 |
Syntactic Control of Interference
- Reynolds
- 1978
(Show Context)
Citation Context ...es of own variables is, as far as I know, an open problem in language design, and a good solution would be a valuable step forward. For a recent promising attempt to control side effects see Reynolds =-=[13]-=-. (3) To complete the list of nontrivial extensions which we have included in ML, consider the declaration (possibly recursive) of a new type operator in terms of old ones. Such a declaration may have... |

130 |
Lambda-calculus models of programming languages
- Morris
- 1968
(Show Context)
Citation Context ..., ?Y is hardly an efficient algorithm; substitutions are applied too often. It was formulated to aid the proof of soundness. We now present a simpler algorithm f which simulates w in a precise sense. =-=(10)-=- (11)s370 ROBIN MILNER 9 differs from ?&‘- in two ways. First, we adopt an idea familiar in the literature on resolution-based theorem-proving systems, in which substitutions are composed, but only ap... |

108 |
Recursive programming techniques
- Burge
- 1975
(Show Context)
Citation Context ...for the two expressions letx = eine’; (Ax . e’)e may be (and are) equivalent, it may be possible to assign types correctly to the former but not to the latter. An example is the pair let1 = Ax . x’inI=-=(1)-=-; (AI . I(l))(Ax . x).sTYPE POLYMORPHISM 355 A (partial) intuition for this is that a h-abstraction may often occur without an argument; the second expression above contains a special (and rather unne... |

52 |
Report on the programming language Euclid
- Lampson
- 1977
(Show Context)
Citation Context ...y-indeed often should-define his own types together with operations over these types. Recent languages which allow the user to define his own types in this manner are CLU [8], ALPHARD [23] and Euclid =-=[6]-=-). Although it can be argued convincingly that to demand type specification for declared variables, including the formal parameters of procedures, leads to more intelligible problems, it is also conve... |

16 |
Programming with abstract data types
- Zilles
- 1974
(Show Context)
Citation Context ... other languages, the user may-indeed often should-define his own types together with operations over these types. Recent languages which allow the user to define his own types in this manner are CLU =-=[8]-=-, ALPHARD [23] and Euclid [6]). Although it can be argued convincingly that to demand type specification for declared variables, including the formal parameters of procedures, leads to more intelligib... |

14 |
A Metalanguage for Interactive Proof
- Gordon, Milner, et al.
- 1978
(Show Context)
Citation Context ...nt) be incorporated without invalidating it. In Section 2 we illustrate our type discipline by examples in a fragment of ML. This fragment should be self-explanatory, but an outline of ML is given in =-=[3]-=- and a full description appears in [2]. These illustrations should serve to make the point that we are able to handle useful languages. The remainder of the paper justifies the discipline using a very... |

10 |
Abstraction and Verification in Alphard: Introduction to Language and Methodology. Technical Report ISI/RR-76-46, USC Information Sciences Institute
- Wulf, London, et al.
- 1976
(Show Context)
Citation Context ...ges, the user may-indeed often should-define his own types together with operations over these types. Recent languages which allow the user to define his own types in this manner are CLU [8], ALPHARD =-=[23]-=- and Euclid [6]). Although it can be argued convincingly that to demand type specification for declared variables, including the formal parameters of procedures, leads to more intelligible problems, i... |

9 |
Wijngaarden et al. Revised report on the algorithmic language ALGOL 68
- van
- 1975
(Show Context)
Citation Context ...ne who mistakenly applies CDR to an atom in LISP, and finds himself absurdly adding a property list to an integer, will know the symptoms. On the other hand a type discipline such as that of ALGOL 68 =-=[22]-=- which precludes the flexibility mentioned above, also precludes the programming style which we are talking about. ALGOL 60 was more flexible-in that it required procedure parameters to be specified o... |

8 |
Lattice theoretic models for various type-free calculi
- Scott
- 1972
(Show Context)
Citation Context ...sum of domains, with Iv adjoined as minimum element), F=V--+V (continuous functions from V to V), W={*> (error). The solution (up to isomorphism) of such a set of domain equations is assured by Scott =-=[15]-=-. Although he worked with complete lattices, the solution also exists in cpos (see Plotkin [ 111). The semantic function is d E Exp + Env -+ V, where Env = Id -+ V, the domain of environments. We use ... |

7 |
Models of LCF
- Milner
- 1973
(Show Context)
Citation Context ... as the condition of a conditional, and the occurrence of a nonfunctional value as the operator of an application. Our semantic domains may be taken to be complete partial orders (cpos); a cpo D (see =-=[9]-=-) is a partially ordered set such that (a) there exist a minimum element, ln , (b) every directed subset of D has a least upper bound in D. Take as given a set {Bi} of basic domains, with B, = T, the ... |

3 | Data types as objects - Shamir, Wadge - 1977 |

1 |
Some ideas on data type in high-level lcnguages
- GRIES, GEHANI
- 1977
(Show Context)
Citation Context ...hich we abbreviate to polytype) in general; only when the types of its arguments and result can be uniquely determined from the context is it monomorphic (i.e., assigned a monotype). Gries and Gehani =-=[4]-=-, among others, have made a convincing case for controlled polymorphic programming (in contrast with the typeless programming in LISP or in SNOBOL); for them however, and also for Tennent [2B], the pr... |

1 | On a new approach to representation-independent data classes - TENNENT - 1977 |

1 |
The treatment of types in ELl
- WEGBREIT
- 1974
(Show Context)
Citation Context ...objects carry their types at run-time. This is widely accepted as yielding efficient object code, though it does impose constraints on the use of types compared with, for example, the approach in EL1 =-=[21]-=-. Second, many nontrivial programs can avoid mentioning types entirely, since they be inferred from context. (In ML however, as in other languages, the user may-indeed often should-define his own type... |