A Compilation Method for Dynamic Typing in ML

Atsushi Ohori, Katsuhiro Ueno

Research output: Chapter in Book/Report/Conference proceedingConference contribution


This paper develops a systematic method for extending a polymorphic type system of ML with dynamic typing, and implements the extension in SML#. The core of the extension consists of an adaptation of the type-directed compilation method for non-parametric polymorphism to type tag abstraction and type tag generation. To support existentially bound type variables in dynamic value elimination and user-level manipulation of dynamic values, the conventional type-directed compilation framework is extended with existential types and a mechanism to reify dynamic values to user-level datatypes. The resulting language achieves orthogonal integration of dynamic typing in ML: it supports all the standard features, including polymorphic type inference, user-defined datatypes and pattern matching, in programming with dynamic typing. The implementation readily provides various practical features, including polymorphic first-class pretty-printer, polymorphic deserialization, type-safe interface to database systems, and type-safe meta-programming.

Original languageEnglish
Title of host publicationProgramming Languages and Systems - 19th Asian Symposium, APLAS 2021, Proceedings
EditorsHakjoo Oh
PublisherSpringer Science and Business Media Deutschland GmbH
Number of pages20
ISBN (Print)9783030890506
Publication statusPublished - 2021
Event19th Asian Symposium on Programming Languages and Systems, APLAS 2021 - Chicago, United States
Duration: 2021 Oct 172021 Oct 18

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume13008 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference19th Asian Symposium on Programming Languages and Systems, APLAS 2021
Country/TerritoryUnited States

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)


Dive into the research topics of 'A Compilation Method for Dynamic Typing in ML'. Together they form a unique fingerprint.

Cite this