An Experiment with lexically-bound extension methods for a dynamic language

Abstract : An extension method is a method declared in a package other than the package of its host class. Thanks to extension methods, developers can adapt classes they do not own to their needs: adding methods to core classes is a typical use case. This is particularly useful for adapting software and therefore increasing reusability. In most dynamically-typed languages, extension methods are globally visible. Because any developer can define extension methods for any class, naming conflicts occur: if two developers define an extension method with the same signature in the same class, only one extension method is visible and overwrites the other. Similarly, if two developers each define an extension method with the same name in a class hierarchy, one overrides the other. Existing solutions typically rely on a dedicated and slow method lookup algorithm to resolve conflicts at runtime. In this article, we present a model of scoped extension methods that minimizes accidental overrides and we present an implementation in Pharo that incurs little performance overhead. This implementation is based on lexical scope and hierarchy-first strategy for extension scoping.
Type de document :
Rapport
[Research Report] Inria Lille - Nord Europe. 2017
Liste complète des métadonnées

https://hal.inria.fr/hal-01483756
Contributeur : Guillermo Polito <>
Soumis le : lundi 6 mars 2017 - 14:01:28
Dernière modification le : jeudi 15 juin 2017 - 09:09:12
Document(s) archivé(s) le : mercredi 7 juin 2017 - 14:05:10

Fichier

conch-tech-report.pdf
Fichiers produits par l'(les) auteur(s)

Identifiants

  • HAL Id : hal-01483756, version 1

Collections

Citation

Stéphane Ducasse, Luc Fabresse, Guillermo Polito, Camille Teruel. An Experiment with lexically-bound extension methods for a dynamic language. [Research Report] Inria Lille - Nord Europe. 2017. 〈hal-01483756〉

Partager

Métriques

Consultations de
la notice

334

Téléchargements du document

71