Scoped Extension Methods in Dynamically-Typed Languages
Guillermo Polito (Centre de Recherche en Informatique Signal et, Automatique de Lille, France), Camille Teruel (Inria, France), St\'ephane, Ducasse (INRIA, France), Luc Fabresse (Mines Telecom Institute, Douai,, France)

TL;DR
This paper formalizes and compares various scoping mechanisms for extension methods in dynamically-typed languages, addressing conflicts and performance issues to guide language design.
Contribution
It provides a formal framework for analyzing and comparing the semantics of different scoping solutions for extension methods in dynamic languages.
Findings
Formal models of Ruby refinements, Groovy categories, Classboxes, and Method Shelters.
Comparison reveals strengths and weaknesses of each scoping approach.
Framework aids language designers in choosing less conflict-prone mechanisms.
Abstract
Context. 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 to their needs classes they do not own: adding methods to core classes is a typical use case. This is particularly useful for adapting software and therefore to increase reusability. Inquiry. 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. To avoid such "accidental overrides", some dynamically-typed languages limit the visibility of an…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
