On flexible dynamic trait replacement for Java-like languages

  • Authors:
  • Lorenzo Bettini;Sara Capecchi;Ferruccio Damiani

  • Affiliations:
  • -;-;-

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

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 objects' 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 the trait replacement operation code and the 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.