Affiliation:
1. Aarhus Univ., Aarhus, Denmark
2. Massachusetts Institute of Technology, Cambridge
Abstract
Partial-evaluation folklore has it that massaging one's source programs can make them specialize better. In Jones, Gomard, and Sestoft's recent textbook, a whole chapter is dedicated to listing such “binding-time improvements”: nonstandard use of continuation-passing style, eta-expansion, and a popular transformation called “The Trick.” We provide a unified view of these binding-time improvements, from a typing perspective. Just as a proper treatment of product values in partial evaluation requires partially static values, a proper treatment of disjoint sums requires moving static contexts across dynamic case expressions. This requirement precisely accounts for the nonstandard use of continuation-passing style encountered in partial evaluation. Eta-expansion thus acts as a uniform binding-time coercion between values and contexts, be they of function type, product type, or disjoint-sum type. For the latter case, it enables “The Trick.” In this article, we extend Gomard and Jones' partial evaluator for the λ-calculus, λ-Mix, with products and disjoint sums; we point out how eta-expansion for (finite) disjoint sums enable The Trick; we generalize our earlier work by identifying the eta-expansion can be obtained in the binding-time analysis simple by adding two coercion rules; and we specify and prove the correctness of our extension to λ-Mix.
Publisher
Association for Computing Machinery (ACM)
Cited by
28 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. flap: A Deterministic Parser with Fused Lexing;Proceedings of the ACM on Programming Languages;2023-06-06
2. WebSpec: Towards Machine-Checked Analysis of Browser Security Mechanisms;2023 IEEE Symposium on Security and Privacy (SP);2023-05
3. Staged compilation with two-level type theory;Proceedings of the ACM on Programming Languages;2022-08-29
4. Staged selective parser combinators;Proceedings of the ACM on Programming Languages;2020-08-02
5. Compiling effect handlers in capability-passing style;Proceedings of the ACM on Programming Languages;2020-08-02