Space-efficient gradual typing

  • Authors:
  • David Herman;Aaron Tomb;Cormac Flanagan

  • Affiliations:
  • Mozilla Research, Mountain View, USA 94116;Computer Science Department, School of Engineering, University of California at Santa Cruz, Santa Cruz, USA 95064;Computer Science Department, School of Engineering, University of California at Santa Cruz, Santa Cruz, USA 95064

  • Venue:
  • Higher-Order and Symbolic Computation
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Gradual type systems offer a smooth continuum between static and dynamic typing by permitting the free mixture of typed and untyped code. The runtime systems for these languages, and other languages with hybrid type checking, typically enforce function types by dynamically generating function proxies. This approach can result in unbounded growth in the number of proxies, however, which drastically impacts space efficiency and destroys tail recursion.We present a semantics for gradual typing that is based on coercions instead of function proxies, and which combines adjacent coercions at runtime to limit their space consumption. We prove bounds on the space consumed by coercions as well as soundness of the type system, demonstrating that programmers can safely mix typing disciplines without incurring unreasonable overheads. Our approach also detects certain errors earlier than prior work.