Integrating Typed and Untyped Code in a
Scripting Language
Tobias Wrigstad, F. Zappa Nardelli, Sylvain Lebresne, Johan
Östlund, Jan Vitek
Many large software systems originate from untyped scripting
language code. While good for initial development, this can
impact code-quality and performance in the long run. We
study a novel approach for integrating untyped and typed
code in the same system to allow an initial script to be
smoothly evolved into a more efficient and robust
system. Our approach adds a novel intermediate point, called
like types, between dynamic and static types. Uses of
variables of like type are checked statically, while
conformance of a value to a like type is checked at run-time
individually at each access. In contrast to previous
proposals, this approach captures common programmer
mistakes, is compatible with object-orientation and can be
implemented efficiently. The parts of a program annotated
with concrete types enjoy the usual static safety guarantees
and can be optimised, while like types improve local safety
and integrate smoothly with untyped parts of a program
without hindering performance.