Abstraction mechanisms in the BETA programming language
Authors: Bent Bruun Kristensen, Ole Lehrmann Madsen, Birger Møller-Pedersen, Kristen Nygaard
Venue: Proceedings of the 10th ACM SIGACT-SIGPLAN symposium on Principles of programming languages (1983)

The BETA programming language is developed as part of the BETA project. The purpose of this project is to develop concepts, constructs and tools in the field of programming and programming languages. BETA has been developed from 1975 on and the various stages of the language are documented in [BETA a]. The application area of BETA is programming of embedded as well as distributed computing systems. For this reason a major goal has been to develop constructs that may be efficiently implemented. Furthermore the BETA language is intended to have a few number of basic but general constructs. It is then necessary that the abstraction mechanisms are powerful in order to define more specialized constructs. BETA is an object oriented language like SIMULA 67 ([SIMULA]) and SMALLTALK ([SMALLTALK]). By this is meant that a construct like the SIMULA class/subclass mechanism is fundamental in BETA. In contrast to SMALLTALK, BETA is a language in the ALGOL 60 ([ALGOL]) family. SIMULA 67 is a system description and a programming language. The DELTA language ([DELTA]) is a system description language only, allowing description of full concurrency, continuous change and component interaction, developed from a SIMULA conceptual platform. BETA started from the system concepts of DELTA, but is a programming language, drawing upon a large number of contributions to programming research in the 1970s. A basic idea in BETA is to build the language upon one, general abstraction mechanism --- the pattern ([BETA a 77]) --- covering both data, procedural and control abstractions, substituting constructs like class, procedure, function and type. Correspondingly objects, procedure activation records and variables are all regarded as special cases of the basic building block of program executions: the entity. A pattern thus describes a category of entities with identical structure. An entity consists of a set of attributes and an action-part. An attribute may be a data-item or a pattern. The action-part is a sequence of imperatives that may be executed. A data-item may be an entity or a reference to an entity. A pattern may be used in a procedure like manner in the sense that an entity (procedure activation record) described by the pattern may be generated and executed as a part of the action sequence of another entity. A pattern may be used to generate entities that execute their action-part in concurrency with other entities. Such entities may also execute their actions interleaved in a coroutine like manner. Entities may be organized hierarcically by means of a generalization of the SIMULA subclass mechanism. This gives possibilities for grouping common properties of entities of different patterns. In SIMULA 67 a class may have virtual attributes (procedures, labels, and switches). This is a powerful parameter mechanism that gives the possibility to delay the specification of an attribute to a subclass specification. However, SIMULA 67 lacks the possibility to have virtual class attributes. Furthermore it is necessary to have a runtime check on the parameters of virtual procedures, since it is not possible to specify the parameter list of a virtual procedure. The virtual patterns of BETA is a generalization of the virtual concept in SIMULA 67. In this paper the sequential part of BETA will be presented. The main purpose is to demonstrate the use of the pattern/subpattern mechanism with virtual patterns as a powerful abstraction mechanism. In addition, a further generalization of the virtual concept based on syntactic categories will be described. Work has been initiated to design and implement an integrated programming system for BETA. The approach to separate compilation of BETA modules is described in [BETA c]. This paper is organised as follows: Section 2 describes entities, patterns and imperatives. Section 3 describes the subpattern mechanism. Virtual patterns are described in section 4. Section 5 describes the generalization of the virtual concept. In section 6 the remaining elements of BETA not mentioned in the previous sections are described. Finally the syntax of BETA is given in the appendix. Each section with a brief introduction of the relevant language elements whereafter a number of examples are given. Most of the examples are extended versions of Hoare's SmallIntSet [Hoare 72]. There is a distinction between the base language (called basic BETA) and standard BETA. Standard BETA is basic BETA extended with a number of commonly used constructs. These additional constructs may all be regarded as patterns in basic BETA, but will often be given a special syntax. This paper will mainly focus on basic BETA. Occasionally we shall use parts of a standard BETA, but this will be stated at the appropiate place.