On Jones-Optimal Specialization for Strongly Typed Languages

Henning Makholm. On Jones-Optimal Specialization for Strongly Typed Languages. In Walid Taha, editor, Semantics, Applications, and Implementation of Program Generation, International Workshop SAIG 2000, Montreal, Canada, September 20, 2000, Proceedings. Volume 1924 of Lecture Notes in Computer Science, pages 129-148, Springer, 2000. [doi]

Abstract

The phrase “optimal program specialization” was defined by Jones et al. in 1993 to capture the idea of a specializer being strong enough to remove entire layers of interpretation. As it has become clear that it does not imply “optimality” in the everyday meaning of the word, we propose to rename the concept “jones-optimality”. We argue that the 1993 definition of Jones-optimality is in principle impossible to fulfil for strongly typed languages due to necessary encodings on the inputs and outputs of a well-typed self-interpreter. We propose a technical correction of the definition which allows Jones-optimality to remain a meaningful concept for typed languages. We extend recent work by Hughes and by Taha and Makholm on the long-unsolved problem of Jones-optimal specialization for strongly typed languages. The methods of Taha and Makholm are enhanced to allow “almost optimal” results when a self-interpreter is specialized to a typeincorrect program; how to do this has been an open problem since 1987. Neither Hughes’ nor Taha—Makholm’s methods are by themselves suffi- cient for Jones-optimal specialization when the language contains primitive operations that produce or consume complex data types. A simple postprocess is proposed to solve the problem. An implementation of the proposed techniques has been produced and used for the first successful practical experiments with truly Jones-optimal specialization for strongly typed languages.