Gradual typing with unification-based inference

  • Authors:
  • Jeremy G. Siek;Manish Vachharajani

  • Affiliations:
  • University of Colorado at Boulder;University of Colorado at Boulder

  • Venue:
  • DLS '08 Proceedings of the 2008 symposium on Dynamic languages
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Static and dynamic type systems have well-known strengths and weaknesses. Gradual typing provides the benefits of both in a single language by giving the programmer control over which portions of the program are statically checked based on the presence or absence of type annotations. This paper studies the combination of gradual typing and unification-based type inference with the goal of developing a system that helps programmers increase the amount of static checking in their program. The key question in combining gradual typing and type inference is how should the dynamic type of a gradual system interact with the type variables of a type inference system. This paper explores the design space and shows why three straightforward approaches fail to meet our design goals. This paper presents a new type system based on the idea that a solution for a type variable should be as informative as any type that constrains the variable. The paper also develops an efficient inference algorithm and proves it sound and complete with respect to the type system.