A VM-Agnostic and Backwards Compatible Protected Modifier for Dynamically-Typed Languages

06/21/2023
by   Iona Thomas, et al.
0

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 inline caches. We show that our name mangling and double method registration technique has a very low impact on performance and keeps the benefits from the global lookup cache and polymorphic inline cache. We also show that the memory overhead on a real use case is between 2 in the worst-case scenario. Protected modifier semantics enforces encapsulation such as private but allow developers to still extend the class in subclasses. ProtDyn offers a VM-agnostic and backwards-compatible design to introduce protected semantics in dynamically-typed languages.

READ FULL TEXT

page 15

page 31

research
08/04/2017

Scoped Extension Methods in Dynamically-Typed Languages

Context. An extension method is a method declared in a package other tha...
research
11/22/2022

Twitter has a Binary Privacy Setting, are Users Aware of How It Works?

Twitter accounts are public by default, but Twitter gives the option to ...
research
01/13/2020

Comparing the impact of subfields in scientific journals

The impact factor has been extensively used in the last years to assess ...
research
10/31/2017

DynSGX: A Privacy Preserving Toolset for Dynamically Loading Functions into Intel(R) SGX Enclaves

Intel(R) Software Guard eXtensions (SGX) is a hardware-based technology ...
research
12/31/2021

Towards a Domain Ontology for the Analysis of Ancient Fabrics The SILKNOW Project and the Case of European Silk Heritage

In this article, we present the SILKNOW project (Silk heritage in the Kn...
research
03/16/2022

Understanding Privacy Switching Behaviour on Twitter

Changing a Twitter account's privacy setting between public and protecte...
research
06/06/2019

Dynamically Allocated Memory Verification in Object-Oriented Programs using Prolog

A Prolog-based framework for fully automated verification currently unde...

Please sign up or login with your details

Forgot password? Click here to reset