Linking as Evaluation: Correct Separate Compilation via First-Class Environments
Jam Kabeer Ali Khan, Jinhao Tan, Bruno C. d. S. Oliveira
Key points
From the paper's conclusion- We present $\lambda_{\mathsf{SCE}}$, a simply typed calculus in which linking, modules, and environments are all first-class.
Abstract
Separate compilation is central to modular software: components are compiled independently and linked into an executable. Separate compilation is correct when a linked program behaves like the program formed by merging its sources. This property is less routine to prove than type soundness because it requires a formal account of linking. We present $\lambda_{\mathsf{SCE}}$, a simply typed calculus in which linking, modules, and environments are all first-class. Programmers control module linking through a link operator, which a type-directed elaboration translates into ordinary terms of a core calculus of first-class environments. The core calculus's existing evaluation rules then perform the linking: linking as evaluation. Linking independently compiled modules yields the same core term as elaborating their source link. Therefore, compilation and linking commute by construction. As a result, separate compilation correctness follows directly from the semantics preservation for both static and dynamic linking. All meta-theory is mechanized in Lean 4, and we implement a compiler to WebAssembly in OCaml.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Preserving Separation Logic Specifications through CompilationarXiv · 2026
- Record Types EverywherearXiv · 2026
- Polymorphic First-Class EnvironmentsarXiv · 2026
- When Do Staging Annotations Preserve Semantics? Mechanizing Typed Semantics-Preserving Multi-stage Programming with Let-InsertionProceedings of the ACM on Programming Languages · 2026
- Denotational Results in Compiler Correctness and Comparisons with Operational ApproachesarXiv · 2026
- Compiling Environment Classifiers to Contextual Modal TypesarXiv · 2026