In this paper we introduce a new view on roles in Object Oriented programming languages, based on an ontological analysis of roles. A role is always associated with an object instance playing the role and also to an object instance (its institution) which represents its context. The definition of a role depends on the definition of the institution. This property allows to endow role-players with powers that can modify the state of the institution and of the other roles defined in it. As an example, we introduce a role construct in Java, where the abolve features are interpreted as follows. Roles are implemented as classes, which can be instantiated only in presence of an instance of the player and of an instance of an institution. The definition of a class implementing a role is included in the class of the institution, the role belongs to. Powers are methods which can access private fields and methods of the institution they belong to, and of the other roles of the same institution.
Matteo Baldoni, Guido Boella, Leendert W. N. van d