Multi-methods (collections of overloaded methods associated to the same message, whose selection takes place dynamically instead of statically as in standard overloading) are a useful mechanism since they unleash the power of dynamic binding in object-oriented languages, so enhancing re-usability and separation of responsibilities. However, many mainstream languages, such as, e.g., Java, do not provide it, resorting to only static overloading. In this paper we propose an extension, we call FMJ (Featherweight Multi Java), of Featherweight Java with encapsulated multi-methods thus providing dynamic overloading. The extension is conservative and type safe: both "message-not-understood" and "message-ambiguous" are statically ruled out. Our core language can be used as the formal basis for an actual implementation of dynamic overloading in Java-like languages.

Featherweight Java with Multi-Methods

BETTINI, LORENZO;CAPECCHI, SARA;VENNERI, Battistina
2007-01-01

Abstract

Multi-methods (collections of overloaded methods associated to the same message, whose selection takes place dynamically instead of statically as in standard overloading) are a useful mechanism since they unleash the power of dynamic binding in object-oriented languages, so enhancing re-usability and separation of responsibilities. However, many mainstream languages, such as, e.g., Java, do not provide it, resorting to only static overloading. In this paper we propose an extension, we call FMJ (Featherweight Multi Java), of Featherweight Java with encapsulated multi-methods thus providing dynamic overloading. The extension is conservative and type safe: both "message-not-understood" and "message-ambiguous" are statically ruled out. Our core language can be used as the formal basis for an actual implementation of dynamic overloading in Java-like languages.
2007
Proc. of PPPJ, Principles and Practice of Programming in Java
ACM
272
83
92
9781595936721
L. BETTINI; S. CAPECCHI; B. VENNERI
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/2318/126557
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 5
  • ???jsp.display-item.citation.isi??? ND
social impact