We present FJig, a simple calculus where basic building blocks are classes in the style of Featherweight Java. However, inheritance has been generalized to the more flexible notion proposed in Bracha's Jigsaw framework. We keep the nominal type approach of Java-like languages, 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, including standard inheritance, mixin classes, traits and hiding. Hence, FJig can be used as a unifying framework for analyzing existing mechanisms and proposing extensions. Two different semantics are provided: flattening and direct. The difference is analogous to that between two intuitive models to understand inheritance: where inherited methods are copied into heir classes, and where member lookup ascends the inheritance chain. We address equivalence of these two views for a more sophisticated composition mechanism.
Featherweight Jigsaw: A Minimal Core Calculus for Modular Composition of Classes
LAGORIO, GIOVANNI;ZUCCA, ELENA
2009-01-01
Abstract
We present FJig, a simple calculus where basic building blocks are classes in the style of Featherweight Java. However, inheritance has been generalized to the more flexible notion proposed in Bracha's Jigsaw framework. We keep the nominal type approach of Java-like languages, 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, including standard inheritance, mixin classes, traits and hiding. Hence, FJig can be used as a unifying framework for analyzing existing mechanisms and proposing extensions. Two different semantics are provided: flattening and direct. The difference is analogous to that between two intuitive models to understand inheritance: where inherited methods are copied into heir classes, and where member lookup ascends the inheritance chain. We address equivalence of these two views for a more sophisticated composition mechanism.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.