Publication

Back to overview

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

Type of publication Peer-reviewed
Publikationsform Proceedings (peer-reviewed)
Author Milojković Nevena, Ghafari Mohammad, Nierstrasz Oscar,
Project Agile Software Analysis
Show all

Proceedings (peer-reviewed)

Title of proceedings 25th IEEE International Conference on Program Comprehension
DOI 10.1109/icpc.2017.33

Open Access

URL http://scg.unibe.ch/archive/papers/Milo17a.pdf
Type of Open Access Website

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.
-