K. Olmos and E. Visser.
Turning dynamic typing into static typing by program specialization. In D. Binkley and P. Tonella, editors,
Third IEEE International Workshop on Source Code Analysis and Manipulation (SCAM'03), Amsterdam, The Netherlands, September 2003. IEEE Computer Society Press. (To appear).
Abstract
Array processing languages such as APL, Matlab and Octave rely
on dynamic typechecking by the interpreter rather than static
typechecking and are designed for user convenience with a
syntax close to mathematical notation. Functions and operators
are highly overloaded. The price to be paid for this
flexibility is computational performance, since the run-time
system is responsible for type checking, array shape
determination, function call dispatching, and handling
possible run-time errors. In order to produce effecient code,
an Octave compiler should address those issues at compile-time
as much as possible. In particular, static type and shape
inferencing can improve the quality of the generated code. In
this paper we discuss how overloading in dynamically typed
Octave programs can be resolved by program specialization. We
discuss the typing issues in compilation of Octave programs
and give an overview of the implementation of the specializer
in the transformation language Stratego.