On inner classes

  • Authors:
  • Atsushi Igarashi;Benjamin C. Pierce

  • Affiliations:
  • Department of Intelligence Science and Technology, Graduate School of Informatics, Kyoto University, Yoshida-Honmachi, Sakyo-ku, Kyoto 606-8501, Japan;Department of Computer and Information Science, University of Pennsylvania, 200 South 33rd Street, Philadelphia, Pennsylvania

  • Venue:
  • Information and Computation - FOOL VII
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Inner classes in object-oriented languages play a role similar to nested function definitions in functional languages, allowing an object to export other objects that have direct access to its own methods and instance variables. However, the similarity is deceptive: a close look at inner classes reveals significant subtleties arising from their interactions with inheritance. The goal of this work is a precise understanding of the essential features of inner classes; our object of study is a fragment of Java with inner classes and inheritance (and almost nothing else). We begin by giving a direct reduction semantics for this language. We then give an alternative semantics by translation into a yet smaller language with only top-level classes, closely following Java's Inner Classes Specification. We prove that the two semantics coincide, in the sense that translation commutes with reduction, and that both are type-safe.