Proceedings Article10.1145/1292535.1292538
Efficient type inference using ranked type variables
George Kuan,David MacQueen +1 more
TL;DR: Two ranking systems based on lambda depth, used in the SML/NJ compiler and OCaml, are formalized, both with and without the value restriction, and they are proved correct relative to the classic algorithm W.
read more
Abstract: The Damas-Milner type inference algorithm (commonly known as algorithm W) is at the core of all ML type checkers. Although the algorithm is known to have poor worst-case behavior [8], in practice well-engineered type checkers will run in approximately linear time. To achieve this efficiency, implementations need to improve on algorithm W's method of scanning the complete type environment to determine whether a type variable can be generalized at a let binding. Following a suggestion of Damas, most ML type checkers use an alternative method based on ranking unification variables to track their position in the type environment.Here we formalize two such ranking systems, one based on lambda depth (used in the SML/NJ compiler), and the other based on let depth (used in OCaml, for instance). Each of these systems is formalized both with and without the value restriction, and they are proved correct relative to the classic algorithm W. Our formalizations of the various algorithms use simple abstract machines that are similar to small-step evaluation semantics.
read more
Chat with Paper
AI Agents for this Paper
Find similar papers on Google Scholar, PubMed and Arxiv
Write a critical review of this paper
Analyze citations of this paper to find unaddressed research gaps
Citations
Defunctionalized interpreters for programming languages
Olivier Danvy
- 20 Sep 2008
TL;DR: This document illustrates how functional implementations of formal semantics (structural operational semantics, reduction semantics, small-step and big-step abstract machines, natural semantics, and denotational semantics) can be transformed into each other.
•Journal Article
Relaxing the value restriction
TL;DR: This work uses a subtyping based approach to recover part of this lost polymorphism, without changing the type algebra itself, and this has significant applications.
37
The complexity of flow analysis in higher-order languages
Harry G. Mairson,David Van Horn +1 more
- 01 Jan 2009
TL;DR: In this paper, lower bounds on the complexity of deciding flow analysis problems in higher-order programming languages have been proved, and it has been shown that for any k > 0, kCFA is complete in polynomial time.
•Dissertation
Graphical types and constraints - second-order polymorphism and inference
Boris Yakobowski
- 17 Dec 2008
TL;DR: Le systeme obtenu est confluent lorsque la reduction forte est autorisee, and verifie the propriete de reduction du sujet.
5
References
A theory of type polymorphism in programming
TL;DR: This work presents a formal type discipline for polymorphic procedures in the context of a simple programming language, and a compile time type-checking algorithm w which enforces the discipline.
2.6K
The revised report on the syntactic theories of sequential control and state
Matthias Felleisen,Robert Hieb +1 more
TL;DR: This paper develops fully compatible equational theories of the same imperative higher-order programming languages that subsume the original calculi of control and state and satisfy the usual Church–Rosser and Standardization Theorems.
577
•Book
Advanced Topics in Types and Programming Languages
Benjamin C. Pierce
- 01 Dec 2004
TL;DR: Topics covered include precise type analyses, which extend simple type systems to give them a better grip on the run time behavior of systems; type systems for low-level languages; applications of types to reasoning about computer programs; type theory as a framework for the design of sophisticated module systems; and advanced techniques in ML-style type inference.
Simple imperative polymorphism
Andrew K. Wright
- 01 Dec 1995
TL;DR: A study of a number of ML programs shows that the inability to type all Hindley-Milner typable expressions seldom impacts realistic programs, so with a module system that separates specifications from implementations, imperative features can be freely used to implement polymorphic specifications.
231
Proofs about a folklore let-polymorphic type inference algorithm
Oukseh Lee,Kwangkeun Yi +1 more
TL;DR: This article formally defines the context-sensitive, top-down type inference algorithm “”, proves its soundness and completeness, and shows a distinguishing property that it always stops earlier than M if the input program is ill typed.
Related Papers (5)
Luis Damas,Robin Milner +1 more
- 25 Jan 1982
Kevin Hammond
- 12 Aug 1991
Ferruccio Damiani,Paola Giannini +1 more
- 02 Apr 1997