Class inheritance and method overriding, as provided by standard class-based languages, are not flexible enough to represent the dynamic behavior of objects; with this respect, object composition and delegation are often advocated as a more flexible alternative to class inheritance since they act at run-time, thus permitting the behavior of objects to be specialized dynamically. In this paper we present Incomplete Featherweight Java (IFJ), an extension of Featherweight Java with incomplete objects, i.e., objects that require some missing methods which can be provided at run-time by composition with another (complete) object. The mechanism for method invocation is based on delegation and it is disciplined by static typing, therefore the language enjoys type safety (which implies no "message-not-understood" run-time errors) and avoids possible accidental overrides due to method clashes.
Type Safe Dynamic Object Delegation in Class-based Languages / Lorenzo Bettini; Viviana Bono. - STAMPA. - -:(2008), pp. 171-180. (Intervento presentato al convegno PPPJ 2008 - 6th International Symposium on Principles and Practice of Programming in Java tenutosi a Modena, Italy nel 9-11 settembre 2008) [10.1145/1411732.1411756].
Type Safe Dynamic Object Delegation in Class-based Languages
BETTINI, LORENZO;
2008
Abstract
Class inheritance and method overriding, as provided by standard class-based languages, are not flexible enough to represent the dynamic behavior of objects; with this respect, object composition and delegation are often advocated as a more flexible alternative to class inheritance since they act at run-time, thus permitting the behavior of objects to be specialized dynamically. In this paper we present Incomplete Featherweight Java (IFJ), an extension of Featherweight Java with incomplete objects, i.e., objects that require some missing methods which can be provided at run-time by composition with another (complete) object. The mechanism for method invocation is based on delegation and it is disciplined by static typing, therefore the language enjoys type safety (which implies no "message-not-understood" run-time errors) and avoids possible accidental overrides due to method clashes.I documenti in FLORE sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.