Dynamic trait replacement is a programming language feature for changing the objects’ behavior at runtime by replacing some of the objects’ methods. In previous work on dynamic trait replacement for JAVA-like languages, the object’s methods that may be replaced must correspond exactly to a named trait used in the object’s class definition. In this paper we propose the notion of replaceable: a programming language feature that decouples trait replacement operation code and class declaration code, thus making it possible to refactor classes and to perform unanticipated trait replacement operations without invalidating existing code. We give a formal account of our proposal through a core calculus, FDTJ (FEATHERWEIGHT DYNAMIC TRAIT JAVA), equipped with a static type system guaranteeing that in a well-typed program no runtime type error will take place.

On Flexible Dynamic Trait Replacement for Java-like Languages

BETTINI, LORENZO;CAPECCHI, SARA;DAMIANI, Ferruccio
2013-01-01

Abstract

Dynamic trait replacement is a programming language feature for changing the objects’ behavior at runtime by replacing some of the objects’ methods. In previous work on dynamic trait replacement for JAVA-like languages, the object’s methods that may be replaced must correspond exactly to a named trait used in the object’s class definition. In this paper we propose the notion of replaceable: a programming language feature that decouples trait replacement operation code and class declaration code, thus making it possible to refactor classes and to perform unanticipated trait replacement operations without invalidating existing code. We give a formal account of our proposal through a core calculus, FDTJ (FEATHERWEIGHT DYNAMIC TRAIT JAVA), equipped with a static type system guaranteeing that in a well-typed program no runtime type error will take place.
2013
78
7
907
932
Featherweight Java; Trait; Type System
Bettini, Lorenzo; Capecchi, Sara; Damiani, Ferruccio
File in questo prodotto:
File Dimensione Formato  
main_4aperto_686514.pdf

Open Access dal 01/08/2015

Tipo di file: POSTPRINT (VERSIONE FINALE DELL’AUTORE)
Dimensione 303.58 kB
Formato Adobe PDF
303.58 kB Adobe PDF Visualizza/Apri
SCP-bcd-2013.pdf

Accesso riservato

Descrizione: Articolo principale (rivista)
Tipo di file: PDF EDITORIALE
Dimensione 392.61 kB
Formato Adobe PDF
392.61 kB Adobe PDF   Visualizza/Apri   Richiedi una copia

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/139534
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 13
  • ???jsp.display-item.citation.isi??? 9
social impact