Skip to Main content Skip to Navigation
Conference papers

Exploiting Type Hints in Method Argument Names to Improve Lightweight Type Inference

Abstract : The lack of static type information is one of the main obstacles to program comprehension in dynamically-typed languages. While static type inference algorithms try to remedy this problem, they usually suffer from the problem of false positives or false negatives. In order to partially compensate for the lack of static type information, a common practice in dynamically-typed languages is to name or annotate method arguments in such a way that they reveal their expected type, e.g., aString, anInt, or string: String. Recent studies confirmed that these type annotations are indeed frequently used by developers in dynamically-typed languages. We propose a lightweight heuristic that uses these hints from method argument names to augment the performance of a static type inference algorithm. The evaluation through a proof-of-concept prototype implemented in Pharo Smalltalk shows that the augmented algorithm outperforms the basic algorithm, and correctly infers types for 81% more method arguments.
Document type :
Conference papers
Complete list of metadata

Cited literature [49 references]  Display  Hide  Download
Contributor : Nevena Milojkovic Connect in order to contact the contributor
Submitted on : Monday, May 8, 2017 - 11:07:45 PM
Last modification on : Tuesday, May 3, 2022 - 11:04:03 AM
Long-term archiving on: : Wednesday, August 9, 2017 - 3:40:40 PM


Files produced by the author(s)


  • HAL Id : hal-01519632, version 1



Nevena Milojković, Mohammad Ghafari, Oscar Nierstrasz. Exploiting Type Hints in Method Argument Names to Improve Lightweight Type Inference. International Conference on Program Comprehension, May 2017, Buenos Aires, Argentina. ⟨hal-01519632⟩



Record views


Files downloads