Method shelters: avoiding conflicts among class extensions caused by local rebinding

  • Authors:
  • Shumpei Akai;Shigeru Chiba

  • Affiliations:
  • Tokyo Institute of Technology, Tokyo, Japan;Tokyo Institute of Technology, Tokyo, Japan

  • Venue:
  • Proceedings of the 11th annual international conference on Aspect-oriented Software Development
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

A class extension, also known as open classes, allows programmers to modify existing classes and thus it is supported by several programming languages. However, class extensions imply a risk that they supply different definitions for the same method and those definitions conflict with each other. Several module systems have been proposed to address these conflicts. One approach lexically restricts the scope of class extensions but they do not allow us to change the behavior of methods called indirectly. Another approach is to make only class extensions explicitly imported effective while preserving the local rebinding property, which allows us to change the behavior of indirectly called methods. However, this approach causes conflicts if potentially conflicting class extensions are imported together. To address this problem, we propose a new module system named method shelters. A method shelter confines a scope of class extensions while preserving the local rebinding property. Hidden class extensions in a method shelter are not visible from the outside. We implemented a prototype of the proposed module system in Ruby. This paper illustrates several examples of the use of method shelters and also shows the results of benchmarks on our prototype.