A Transient Semantics for Typed Racket

Ben Greenman, Lukas Lazarek, Christos Dimoulas, Matthias Felleisen

Research output: Contribution to journalArticlepeer-review

Abstract

Mixed-typed languages enable programmers to link typed and untyped components in various ways. Some offer rich type systems to facilitate the smooth migration of untyped code to the typed world; others merely provide a convenient form of type Dynamic together with a conventional structural type system. Orthogonal to this dimension, Natural systems ensure the integrity of types with a sophisticated contract system, while Transient systems insert simple first-order checks at strategic places within typed code. Fur-thermore, each method of ensuring type integrity comes with its own blame-assignment strategy. Typed Racket has a rich migratory type system and enforces the types with a Natural semantics. Reticu-lated Python has a simple structural type system extended with Dynamic and enforces types with a Transient semantics. While Typed Racket satisfies the most stringent gradual-type soundness properties at a significant performance cost, Reticulated Python seems to limit the performance penalty to a tolerable degree and is nevertheless type sound. This comparison raises the question of whether Transient checking is applicable to and beneficial for a rich migratory type system. This paper reports on the surprising difficulties of adapting the Transient semantics of Reticulated Python to the rich migratory type system of Typed Racket. The resulting implementation, Shallow Typed Racket, is faster than the standard Deep Typed Racket but only when the Transient blame assignment strategy is disabled. For language designers, this report provides valuable hints on how to equip an existing compiler to support a Transient semantics. For theoreticians, the negative experience with Transient blame calls for a thorough investigation of this strategy.

Original languageEnglish (US)
Article number9
JournalArt, Science, and Engineering of Programming
Volume6
Issue number2
DOIs
StatePublished - 2022

Keywords

  • compilers
  • gradual typing
  • migratory typing
  • transient semantics

ASJC Scopus subject areas

  • Artificial Intelligence
  • Computational Theory and Mathematics
  • Software
  • Theoretical Computer Science
  • Modeling and Simulation

Fingerprint

Dive into the research topics of 'A Transient Semantics for Typed Racket'. Together they form a unique fingerprint.

Cite this