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; Sara, Capecchi; Ferruccio, Damiani. - In: SCIENCE OF COMPUTER PROGRAMMING. - ISSN 0167-6423. - STAMPA. - 78:7(2013), pp. 907-932. [10.1016/j.scico.2012.11.003]

On Flexible Dynamic Trait Replacement for Java-like Languages

BETTINI, LORENZO;
2013

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
907
932
Bettini, Lorenzo; Sara, Capecchi; Ferruccio, Damiani
File in questo prodotto:
File Dimensione Formato  
On Flexible dynamic trait replacement.pdf

accesso aperto

Tipologia: Pdf editoriale (Version of record)
Licenza: Solo lettura
Dimensione 392.61 kB
Formato Adobe PDF
392.61 kB Adobe PDF

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

Utilizza questo identificatore per citare o creare un link a questa risorsa: https://hdl.handle.net/2158/1039527
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 13
  • ???jsp.display-item.citation.isi??? 9
social impact