Exploiting Type Hints in Method Argument Names to Improve Lightweight Type Inference - Pharo Access content directly
Conference Papers Year : 2017

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.
Fichier principal
Vignette du fichier
CPA-preprint.pdf (281.4 Ko) Télécharger le fichier
Origin : Files produced by the author(s)
Loading...

Dates and versions

hal-01519632 , version 1 (08-05-2017)

Identifiers

  • HAL Id : hal-01519632 , version 1

Cite

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⟩

Collections

PHARO
143 View
496 Download

Share

Gmail Facebook X LinkedIn More