Practical type inference based on success typings
2006 (English)In: Proc. 8th ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming, 2006, 167-178 p.Conference paper (Refereed)
In languages where the compiler performs no static type checks, many programs never go wrong, but the intended use of functions and component interfaces is often undocumented or appears only in the form of comments which cannot always be trusted. This often makes program maintenance problematic. We show that it is possible to reconstruct a significant portion of the type information which is implicit in a program, automatically annotate function interfaces, and detect definite type clashes without fundamental changes to the philosophy of the language or imposing a type system which unnecessarily rejects perfectly reasonable programs. To do so, we introduce the notion of success typings of functions. Unlike most static type systems, success typings incorporate subtyping and never disallow a use of a function that will not result in a type clash during runtime. Unlike most soft typing systems that have previously been proposed, success typings allow for compositional, bottom-up type inference which appears to scale well in practice. Moreover, by taking control-flow into account and exploiting properties of the language such as its module system, success typings can be refined and become accurate and precise We demonstrate the power and practicality of the approach by applying it to Erlang. We report on our experiences from employing the type inference algorithm, without any guidance, on programs of significant size.
Place, publisher, year, edition, pages
2006. 167-178 p.
IdentifiersURN: urn:nbn:se:uu:diva-21133DOI: doi:10.1145/1140335.1140356ISBN: 1-59593-388-3OAI: oai:DiVA.org:uu-21133DiVA: diva2:48906