A VM-Agnostic and Backwards Compatible Protected Modifier for Dynamically-Typed Languages
Iona Thomas (1), Vincent Aranega (1), St\'ephane Ducasse (1),, Guillermo Polito (1), Pablo Tesone (1) ((1) University of Lille, France /, Inria, France / CNRS, France / Centrale Lille, France / CRIStAL, France)

TL;DR
ProtDyn introduces a VM-agnostic, backwards-compatible protected method visibility model for dynamically-typed languages, enhancing encapsulation with minimal performance and memory overhead, demonstrated through implementations in Pharo and Python.
Contribution
The paper presents ProtDyn, a novel compile-time visibility model for dynamic languages that is VM-agnostic and backward compatible, using name mangling and syntactic differentiation.
Findings
Low performance impact with global lookup caches and inline caches
Memory overhead between 2% and 13% in real use cases
Effective encapsulation with protected semantics in dynamic languages
Abstract
In object-oriented languages, method visibility modifiers hold a key role in separating internal methods from the public API. Protected visibility modifiers offer a way to hide methods from external objects while authorizing internal use and overriding in subclasses. While present in main statically-typed languages, visibility modifiers are not as common or mature in dynamically-typed languages. In this article, we present ProtDyn, a self-send-based visibility model calculated at compile time for dynamically-typed languages relying on name-mangling and syntactic differentiation of self vs non self sends. We present #Pharo, a ProtDyn implementation of this model that is backwards compatible with existing programs, and its port to Python. Using these implementations we study the performance impact of ProtDyn on the method lookup, in the presence of global lookup caches and polymorphic…
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.
