Typed and Jones Optimal Self-Applicable Partial Evaluation
We present the first typed self-applicable partial evaluator that operates on typed program representations and always generates type-correct code. It supports the Futamura projections, the canonical benchmarks for a self-applicable partial evaluator, and is also Jones optimal, the gold-standard for demonstrating that a partial evaluator does a significant amount of specialization. Our key to Jones optimality is a novel affine-variable analysis that helps control partial evaluation.
We have implemented our partial evaluator for F$_\omega^{\mu i}$, a recent language for typed self-applicable meta-programming. We have experimentally verified that our partial evaluator is Jones optimal for call-by-value, normal-order, and memoized normal-order reduction, and we have formally proved Jones optimality for call-by-value.