Guy L. Steele Jr. | 2 | LAMBDA: The Ultimate Declarative |
- Environment operations
- Formal procedure parameters
- Declarations within blocks
- Assignments to local variables
- Pattern matching
- Side effects
- Assignments to global (or
COMMON
) variables - Input/output
- Assignments to array elements
- Assignments to other data structures
- Assignments to global (or
- Process synchronization
- Semaphores
- Critical regions
- Monitors
- Path expressions
Often attempts are made to reduce the number of operations of each type to some minimal set. Thus, for example, there have been proofs that sequential blocks, IF
-THEN
-ELSE
, and WHILE
-DO
form a complete set of control operations. One can even do without IF
-THEN
-ELSE
, though the technique for eliminating it seems to produce more rather than less complexity. {Note No IF-THEN-ELSE} A minimal set should contain primitives which are not only universal but also easy to describe, simple to implement, and capable of describing more complex constructs in a straightforward manner. This is why the semaphore is still commonly used; its simplicity makes it easy to describe more complex synchronization operators. The expositors of monitors and path expressions, for example, go to great lengths to describe them in terms of semaphores [Hoare 74] [Campbell 74]; but it would be difficult to describe either of these "high-level" synchronization constructs in terms of the other.
With the criteria of simplicity, universality, and expressive power in mind, let us consider some choices for sets of control and environment operators. Side effects and process synchronization will not be treated further in this paper.
Function Invocation: The Ultimate Imperative
The essential characteristic of a control operator is that it transfers control. It may do this in a more or less disciplined way, but this discipline is generally more conceptual than actual; to put it another way, "down underneath, DO
, CASE
, and SELECT
all compile into IF
s and GOTO
s". This is why many people resist the elimination of GOTO
from high-level languages; just as the semaphore seems to be a fundamental synchronization primitive, so the GOTO
seems to be a fundamental control primitive from which, together with IF
, any more complex one can be constructed if necessary. (There has been a recent controversy over the nested IF
-THEN
-ELSE
as well. Alternatives such as repetitions of tests or decision tables have been examined. However, there is no denying that IF
-THEN
-ELSE
seems to be the simplest conditional control operator easily capable of expressing all others.)
One of the difficulties of using GOTO
, however, is that to communicate information from the code gone from to the code gone to it is necessary to use global variables. This was a fundamental difficulty with the CONNIVER language [McDermott 74], for example; while CONNIVER allowed great flexibility in its control structures, the passing around of data was so undisciplined as to be completely unmanageable. It would be nice if we had