Smartest recompilation

Zhong Shao, Andrew W. Appel

1993 · 66 citations · 17 references

DOIFull text

Open access

Concepts

TL;DR

In statically typed languages, separate compilation requires a manually specified import interface, and any change to external symbols forces recompilation of the module. This paper proposes an algorithm that automatically infers the minimal import interface for any module in Damas‑Milner type systems such as ML. By compiling each module with its inferred minimal interface, the resulting separate compilation method ensures that a unit is recompiled only when its own implementation changes.

Abstract

To separately compile a program module in traditional statically-typed languages, one has to manually write down an import interface which explicitly specifies all the external symbols referenced in the module. Whenever the definitions of these external symbols are changed, the module has to be recompiled. In this paper, we present an algorithm which can automatically infer the “minimum” import interface for any module in languages based on the Damas-Milner type discipline (e.g., ML). By “minimum”, we mean that the interface specifies a set of assumptions (for external symbols) that are just enough to make the module type-check and compile. By compiling each module using its “minimum” import interface, we get a separate compilation method that can achieve the following optimal property: A compilation unit never needs to be recompiled unless its own implementation changes.

References

17