A Parallel Object-Oriented Language with Inheritance and Subtyping Pierre America F’rank van der Linden Philips Research Laboratories Eindhoven, the Netherlands July 12, 1990 Abstract This paper shows that inheritance and subtyping can be introduced advante.geously into a parallel object- oriented language, POOLI. These concepts are clearly distinguished, because they deal with different aspects of progr amming. In this way several problems tradi- tionally adhering to inheritance can be solved. The language POOL-I is a parallel object-oriented lan- guage with a strong typing scheme which includes genericity and dynamic binding. A novel and par- ticularly powerful mechanism offers the possibility to manipulate and analyse types dynamically. 1 Introduction The parallel object-oriented language POOL [l, 41 has been designed to support writing programs for large-scale parallel machines, even without shared memory. At this moment one such machine, the lOOnode DOOM (Decentralized Object-Oriented Ma- chine) [6, 81 is already executing programs written in POOL. In this paper we discuss the language POOL-I, which is the latest member of the POOL family of lan- guages. We shall pay particular attention to the way in which subtyping and inheritance are incorporated in POOL-I. In POOL parallelism is introduced by giving each ob ject a body. This body is a local process that the ob- ject executes in parallel with other objects. At spe- cific places during the execution of the body the ob- This work was done in the context of ESPRIT Basic Re- search Action 3020: Integration Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. @ 1990 ACM 089791-41 l-2/90/0010-0161...$1.50 ject is willing to communicate with other objects. The communication is by synchronous message passing. A message consists of a method call to another object. The object that sends the message is blocked until the receiver answers the message, executes the corre- sponding method, and returns the result to the caller. Both sending and receiving a message take place ex- plicitly (by send statements and answer statements). For many objects, no specific body is specified. In this case they execute the default body, which answers all messages one after the other, in the order in which they arrive. It turns out that in POOL1 there is only a weak interaction between inheritance and subtyping on the one hand and parallelism on the other, see sec- tions 2 and 5. Therefore, in this paper we do not deal extensively with aspects of parallelism. At any moment during the execution of a program, new objects may be created. This is done by exe- cuting a routine called new. A routine is a kind of procedure different from a method. It is not associ- ated with a specific object but with a class and it can be called by any object in the system without sending messages. Every class has a routine with the name new that creates a new object. Objects are never de- stroyed explicitly in POOL (but they may be removed by a garbage collector). At this point we wish to draw attention to the very important distinction between types and classes. A type is a collection of objects that share the same ex- ternally observable behaviour. That means that in deciding whether an object belongs to a type, the only important aspects are which messages the object an- swers (and sends), in which order, and which relation- ships exist between the ar,suments and results of those messages. On the other hand, a cZa.ss is a collection of objects that have exactly the same internal struc- ture, that is, the same instance variables, the same body, and the same methods. One could say that a class describes how its instances are built, and a type describes how its elements can be used. Distinguish- October 21-25, 1990 ECOOP/OOPSLA ‘90 Proceedings 161