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.
Type de document :
Communication dans un congrès
International Conference on Program Comprehension, May 2017, Buenos Aires, Argentina
Liste complète des métadonnées

Littérature citée [49 références]  Voir  Masquer  Télécharger

https://hal.inria.fr/hal-01519632
Contributeur : Nevena Milojkovic <>
Soumis le : lundi 8 mai 2017 - 23:07:45
Dernière modification le : mercredi 10 mai 2017 - 01:08:32
Document(s) archivé(s) le : mercredi 9 août 2017 - 15:40:40

Fichier

CPA-preprint.pdf
Fichiers produits par l'(les) auteur(s)

Identifiants

  • HAL Id : hal-01519632, version 1

Collections

Citation

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〉

Partager

Métriques

Consultations de la notice

135

Téléchargements de fichiers

84