Featherweight Jigsaw: A Minimal Core Calculus for Modular Composition of Classes

  • Authors:
  • Giovanni Lagorio;Marco Servetto;Elena Zucca

  • Affiliations:
  • DISI, Univ. of Genova, Genova, Italy 16146;DISI, Univ. of Genova, Genova, Italy 16146;DISI, Univ. of Genova, Genova, Italy 16146

  • Venue:
  • Genoa Proceedings of the 23rd European Conference on ECOOP 2009 --- Object-Oriented Programming
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present FJig, a simple calculus where basic building blocks are classes in the style of Featherweight Java, declaring fields, methods and one constructor. However, inheritance has been generalized to the much more flexible notion originally proposed in Bracha's Jigsaw framework. That is, classes play also the role of modules, that can be composed by a rich set of operators, all of which can be expressed by a minimal core. We keep the nominal approach of Java-like languages, that is, types are class names. However, a class is not necessarily a structural subtype of any class used in its defining expression. The calculus allows the encoding of a large variety of different mechanisms for software composition in class-based languages, including standard inheritance, mixin classes, traits and hiding. Hence, FJig can be used as a unifying framework for analyzing existing mechanisms and proposing new extensions. We provide two different semantics of an FJig program: flattening and direct semantics. The difference is analogous to that between two intuitive models to understand inheritance: the former where inherited methods are copied into heir classes, and the latter where member lookup is performed by ascending the inheritance chain. Here we address equivalence of these two views for a more sophisticated composition mechanism.