## Pragmatic Subtyping in Polymorphic Languages (1997)

Venue: | In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP'98 |

Citations: | 14 - 2 self |

### BibTeX

@INPROCEEDINGS{Nordlander97pragmaticsubtyping,

author = {Johan Nordlander},

title = {Pragmatic Subtyping in Polymorphic Languages},

booktitle = {In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP'98},

year = {1997},

pages = {216--227}

}

### Years of Citing Articles

### OpenURL

### Abstract

We present a subtyping extension to the Hindley/Milner type system that is based on name inequivalence. This approach allows the subtype relation to be defined by incremental construction of polymorphic records and datatypes, in a way that subsumes the basic type systems of both languages like ML and Java. As the main contribution of the paper, we describe a partial type inference algorithm for the extended system which favours succinctness over generality, in the sense that it never infers types with subtype constraints. The algorithm is based on an efficient approximating constraint solver, and is able to type a wide range of programs that utilize subtyping and polymorphism in a non-trivial way. Since constrained types are not inferred, the algorithm cannot be complete; however, we provide a completeness result w. r. t. the Hindley/Milner type system as a form of characterizing lower bound. 1 Introduction The combination of subtyping with polymorphic type inference has been under i...

### Citations

1626 | The Definition of Standard ML - Milner, Tofte, et al. - 1990 |

985 | A Theory of Type Polymorphism in Programming
- Milner
- 1978
(Show Context)
Citation Context ...ets fffsIntg and fffsfi; Realsfig, solving the first set separately would lead to success even with our simple strategy. This requirement actually puts us closer to the standard inference algorithm W =-=[Mil78]-=- than what is customary in the literature on subtype inference. As we have indicated, we will have good reasons for solving constraints as soon as they are generated, rather than propagating them upwa... |

798 | On understanding types, data abstraction, and polymorphism
- Cardelli, Wegner
- 1985
(Show Context)
Citation Context ...ation For a built-in type, these choices must of course be consistent with the dynamic semantics of terms of that type, which for the function symbol means that (!) + = f2g, and (!) \Gamma = f1g (see =-=[CW85]-=-). Thus, rule (depth) replaces and generalizes the standard rule for functions (called (arrow) in [Hen96]). As regards types defined by the programmer, section 5 will describe how variance information... |

347 | An efficient unification algorithm
- Martelli, Montanari
(Show Context)
Citation Context ...imating subtype constraint solver, that has the merit of being simple and efficient -- in fact it is defined as a small extension to the very efficient unification algorithm of Martelli and Montanari =-=[MM82]-=-. The main characteristic of our solver is that it approximates constraints of the form ffsfi as equality constraints, and resorts to unification in these cases. When all such constraints are removed ... |

224 | Type inclusion constraints and type inference
- Aiken, Wimmers
- 1993
(Show Context)
Citation Context ...ms above. Aiken and Wimmers' constraint solver makes some non-conservative simplifications in the interest of efficiency, although for a very rich type language including union and intersection types =-=[AW93]-=-. Reppy and Riecke have implemented type inference for OML such that only constraint-free type schemes are inferred [RR96], but they do not describe their algorithm, nor do they provide any technical ... |

183 | A system of constructor classes: overloading and implicit higherorder polymorphism
- Jones
(Show Context)
Citation Context ...tions, the algorithm is complete. There are also some interesting extensions that we would like to explore, including type-checking recursive constraints, implementing higher-order polymorphism as in =-=[Jon93]-=-, and investigating ways to encode and eventually integrate the overloading system of Haskell. Acknowledgement The author would like to thank Thomas Hallgren, Magnus Carlsson, Lars Pareto, Bjorn von S... |

182 | Refinement types for ML
- Freeman, Pfenning
- 1991
(Show Context)
Citation Context ... f\Phi 0 \Phi[=ff] 0sg \Phi 00 \Phi 0 C; \Phi 00 [=ff]D 0 ; \Gamma j=P (e :: 8ff: 0 jD 0 ) : \Phi 00 () (typ") Figure 7: The integrated type-checking/type-inference algorithm work on refinement t=-=ypes [Fre94]-=-, although in a quite different setting where the subtyping system is used to provide additional information on terms that already have an ML type. We are not aware of any system besides ours that pro... |

171 | Local type inference
- Pierce, Turner
- 1998
(Show Context)
Citation Context ... type inference as a special 6 Alternatively, we could have let the contextual information flow in the other direction and extract the expected type of e 0 from the type inferred for e, as is done in =-=[PT98]-=-. But this scheme would not make any good use of the parameters, and since we most often do not need to help the inference algorithm finding types for the anonymous lambda abstractions that might appe... |

105 | Sound polymorphic type inference for objects
- Eifrig, Smith, et al.
- 1995
(Show Context)
Citation Context ...e-related [Mit84, FM90, FM89, Mit91, Kae92, Smi94, AW93, MW97]. This leads to a subtyping theory where the only primitive subtype relationships are between nullary base types. The system described in =-=[EST95]-=- follows [CW85] and allows two records to be subtype related if their set of selectors are in a superset relationship. Still, it is the structure of a record that defines its position in the subtype h... |

98 | Type inference with simple subtypes - Mitchell - 1991 |

79 | Type inference with subtypes - Fuh, Mishra - 1988 |

72 | Coercion and type inference - Mitchell - 1984 |

66 | Using parameterized signatures to express modular structure - Jones - 1996 |

63 | Polymorphic type inference and abstract data types - Läufer, Odersky - 1994 |

62 | Subtyping constrained types - Trifonov, Smith - 1996 |

55 | Type inference in the presence of overloading, subtyping and recursive types - Kaes - 1992 |

53 | A practical subtyping system for Erlang - Marlow, Wadler - 1997 |

51 |
Obective ML: A simple object-oriented extension of ML
- Rémy, Vouillon
- 1997
(Show Context)
Citation Context ...algorithm solves all constraints, including those on variables in the assumption environment, at the earliest stage possible, thus its behaviour can sometimes appear quite unpredictable. Objective ML =-=[RV97]-=- conservatively extends ML with subtype inference and a powerful type abbreviation mechanism that achieves much of the succinctness we obtain by using name inequivalence. The type system of Objective ... |

50 | First-class polymorphism with type inference - Jones - 1997 |

45 | Polymorphic type schemes for functional programs with overloading and subtyping - Smith - 1994 |

44 | Simple objects for Standard ML
- Reppy, Riecke
- 1996
(Show Context)
Citation Context ... polymorphic subtype inference for such systems have not gained much attention. Reppy and Riecke develop a scheme where object types are related by declaration in their object-oriented ML variant OML =-=[RR96]-=-, while Jategonkar and Mitchell outline a similar (future) system for abstract datatypes in [JM93]. Both these systems consider only parameterless type constants. Depth subtyping and variances appear ... |

32 | Polymorphic subtype inference: Closing the theory- practice gap - Fuh, Mishra - 1989 |

30 | Lower bounds on type inference with subtypes - Hoang, Mitchell - 1995 |

17 | An implementation of F
- Cardelli
- 1993
(Show Context)
Citation Context ...thm is not complete w. r. t. the Hindley/Milner system, but they have the advantage of a declarative specification of the programs that the inference algorithm accepts. Cardelli's implementation of F =-=[Car93] also cont-=-ains a partial type inference algorithm that, like ours, uses unification to solve constraints involving unbound type variables. However, this "greedy" algorithm solves all constraints, incl... |

14 | Minimal typings in atomic subtyping - Rehof - 1997 |

13 |
Type inference with extended pattern matching and subtypes
- Jategaonkar, Mitchell
- 1993
(Show Context)
Citation Context ...evelop a scheme where object types are related by declaration in their object-oriented ML variant OML [RR96], while Jategonkar and Mitchell outline a similar (future) system for abstract datatypes in =-=[JM93]-=-. Both these systems consider only parameterless type constants. Depth subtyping and variances appear in Freeman's ff i = fv(oe)s0 jD = inst(oe) \Phi j=P f[ i =ff i ] 0sg f\Phi isff i g ff i 2oe \Gamm... |

10 | Reactive objects in a functional language – an escape from the evil
- Nordlander, Carlsson
- 1997
(Show Context)
Citation Context ...n all such constraints are removed 2 The latter axiom expresses that a value of type Action can be promoted to the monad of commands that execute in a local state ff and return values of type (). See =-=[NC97]-=- for more information on this monad. 3 Note that this statement does not say anything about the satisfiabilitysof the constraints that are generally contained in oe. from a constraint set, computation... |

8 | Polymorphic extensible records for Haskell - Gaster - 1997 |

5 | Syntactic properties of polymorphic subtyping
- Henglein
- 1996
(Show Context)
Citation Context ...type constraints, a subtype relation, and a subsumption rule. Such extensions are well represented in the literature [Kae92, Smi94, AW93, EST95]; in this paper we will adopt a formulation by Henglein =-=[Hen96], which has the inte-=-resting merit of being "generic" in its subtyping theory. Since our system is obtained by "instantiation" with a particular form of subtyping theory, the results of [Hen96] directl... |