CLU (programming language)

from Wikipedia, the free encyclopedia

CLU is a programming language developed between 1974 and 1975 at the Massachusetts Institute of Technology by Barbara Liskov and her students. According to Liskov, CLU was the first implemented programming language that offered direct linguistic support for data abstraction , which was a key element in the development of object-oriented programming languages.

The idea of ​​data abstraction came up in the course of work on programming methodology. The primary goal of the project that led to the development of CLU was to advance research into programming methodology. According to their own statements, the developers of the language did not see their goal in spreading the same, but rather in spreading the concepts for software development; which were implemented in CLU. They measure their success in the influence that their publications should have on the development of future programming languages ​​and their application in practice. CLU was thus given a symbolic character. The development of CLU was supported by DARPA and the National Science Foundation .

CLU is not designed for so-called low-level programming , which is e.g. B. used in the development of operating systems and their components. The language should appeal to experienced programmers. Although it is not intended as a learning language for academic purposes like Pascal , it can also be used as such. CLU favors the readability and comprehensibility of software systems over the simplicity of being able to write working code. It is technically meant to be a large-scale development tool. The focus was placed on the development of large software systems that require several developers and whose scope includes several thousand to one hundred thousand lines of code.

Language development

CLU was originally developed by four people: Barbara Liskov and students Russ Atkinson, Craig Schaffert and Alan Snyder . Steve Zilles was heavily involved in the first work on CLU. From 1974, however, he intensified his activities on the specifications of abstract types and in the end acted more and more as an interested onlooker and critic of the design process. Over time, more students were added, including Bob Scheifler and Eliot Moss. The development was strongly geared towards teamwork. It is therefore not possible to assign individual language elements to individual developers. The implementation took place parallel to the language draft. The implementation was never allowed to dictate the design of the language elements. The completion of language elements was delayed until the design of those was completed.

Different programming languages ​​were studied to clarify which of them could possibly be used as a basis for CLU. The developers concluded that none of the languages ​​would be suitable as none of them support data abstraction. The developers wanted to know where this idea would take them without worrying about how it might interact with pre-existing properties. However, various language elements have been adopted from existing programming languages. The semantic model is largely based on Lisp ; the syntax was adopted from ALGOL .

Language elements

Cluster

One of the most important elements of CLU is the concept of the cluster. This corresponds to an object in an object-oriented language such as C ++ and has roughly the same syntax.

An example is an implementation for complex numbers:

    complex_number = cluster is add, subtract, multiply, ...
        rep = record [ real_part: real, imag_part: real ]
        add = proc ... end add;
        subtract = proc ... end subtract;
        multiply = proc ... end multiply;
        ...
    end complex_number;

Although the concept of the clusters represented an advanced tool for structuring program code at the time, there is no mechanism whatsoever to structure the clusters themselves. This means that cluster names are global and no grouping or nesting of clusters is possible. CLU does not support implicit type conversion: in a cluster, the explicit conversions with the commands upand alternate downbetween the abstract type and the representation. Furthermore, a universal data type anyand a procedure force[]are provided. The procedure checks whether an object has a certain type. Objects can have the properties mutableand immutable. The latter are called native data types such as B. Integer defined.

Other language elements

Many functions of object-oriented languages ​​such as B. Inheritance was deliberately not implemented for design reasons, on the other hand, CLU supports language elements such as exception handling , iterators and parameterized types.

Exception handling

CLU also supports exception handling . It offers a mechanism based on the scheduling model for exceptions. A function call can end itself under various conditions, one of the conditions is the termination of the function with a defined normal return value. Any other value is an exception. The CLU mechanism is unusual in its handling of unhandled exceptions. Most mechanisms for exception handling pass them on through the tree of function calls in a program code: If the function in which the exception was raised does not handle it, it is passed on to the function preceding in the tree. In CLU, on the other hand, all unhandled exceptions are converted into so-called failures and passed on as such. Based on many attempts in other programming languages, exceptions are signalraised with and exceptcaught with . Since the focus was placed on the type design, there is no possibility of creating enumerated types.

Iterators

Another important element of CLU are the iterators . These designate a pointer that can be used to iterate over the elements of a list or through the elements of a set. Iterators were based on a construct called a generator, which was used in the Alphard programming language . The CLU developers got to know the idea of ​​the generators during a conference with the Alphard Group. The concept interested the CLU developers as it solved various problems related to data abstraction. However, they also feared that this construct would be too complex. Nevertheless, Russ Atkinson, inspired by the generators, designed the concept of iterators in CLU during a return flight from the conference to Boston. He described this in a so-called design note in September 1975. An iterator in CLU represents a “ black box ” that provides a programming interface independent of the data on which it is applied . Thus z. B. the iterators for complex numbers and those for integer data fields are identical. Iterators are now a common language element in many modern programming languages.

Multiple assignment

CLU also supports multiple assignment , with which more than one variable can be on the left side of the assignment operator. For example, would x,y = y,xexchange values ​​between the variables x and y. In the same way, functions can have multiple values ​​such as B. x,y,z = f(t)return.

Influence on other programming languages

  • Python and Ruby adopted various concepts from CLU such as B. the yieldstatement and the multiple assignment.
  • CLU and Ada were the main models for templates in C ++ .
  • The CLU exception handling mechanisms influenced more modern programming languages ​​such as C ++ and Java .
  • All CLU objects exist in the heap and memory management is automatic. This affected Java in a direct way.
  • Python and C # offer the concept of generators, which first appeared as iterators in CLU.
  • Lua took over the multiple assignment as well as the multiple return of function values ​​from CLU.

literature

Web links