<- People Behind Informatics


All 0-9 A B C D E F G H I J K L M N O P Q R S T U V W XY Z




 
Coroutines
In sequential programming, the relationship between program units is asymmetric. One program unit calls another unit that will execute completely and return to the calling unit. This master/subordinate relationship is not suitable for every application. Sometimes it is better to regard them as coroutines operating in some sense at the same level. Coroutines work on the same level and it is possible to invoke them repeatedly from within the other. In SIMULA, a coroutine is represented by an object of some class, cooperating by means of resume instructions with objects of the same or another class, which are named by means of reference variables. The communication of information may be accomplished in variables either global to all the objects or local to one of them; a producing coroutine assigns values to these variables, and the consuming coroutine accesses them. In the case of two-way communication, both coroutines may update the same global variables in turn. A main program may establish a coroutine relationship with an object that it has generated. In this case, the generated object remains subordinate to the main program, and for this reason is sometimes known as a semicoroutine. But a semicoroutine may also be a full coroutine with respect to a group of other generated objects, with which it communicates by means of resume statements. [Source: Dahl, Ole-Johan: Structured programming (O.-J. Dahl, E.W. Dijkstra, C.A.R. Hoare.) Academic Press, 1972]
 

 

<- People Behind Informatics


Home  |  Top  |  Search  |  Gallery  | Glossary  | Sitemap  |  Making Of  |  Help