HOME

TheInfoList



OR:

CLU is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
created at the
Massachusetts Institute of Technology The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of th ...
(MIT) by
Barbara Liskov Barbara Liskov (born November 7, 1939 as Barbara Jane Huberman) is an American computer scientist who has made pioneering contributions to programming languages and distributed computing. Her notable work includes the development of the Liskov su ...
and her students starting in 1973.Liskov, Barbara (1992). "A history of CLU". The second ACM SIGPLAN conference on History of programming languages. While it did not find extensive use, it introduced many features that are used widely now, and is seen as a step in the development of
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
(OOP). Key contributions include
abstract data type In computer science, an abstract data type (ADT) is a mathematical model for data types. An abstract data type is defined by its behavior (semantics) from the point of view of a ''user'', of the data, specifically in terms of possible values, pos ...
s, call-by-sharing, iterators, multiple return values (a form of parallel assignment), type-safe parameterized types, and type-safe variant types. It is also notable for its use of classes with constructors and methods, but without
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Of ...
.


Clusters

The
syntax In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure ( constituenc ...
of CLU was based on
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
, then the starting point for most new language designs. The key addition was the concept of a ''cluster'', CLU's type extension system and the root of the language's name (CLUster). Clusters correspond generally to the concept of a "class" in an OO language. For instance, here is the CLU syntax for a cluster that implements
complex number In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the fo ...
s:
    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;
A cluster is a module that encapsulates all of its components except for those explicitly named in the "is" clause. These correspond to the public components of a class in recent OO languages. A cluster also defines a type that can be named outside the cluster (in this case, "complex_number"), but its representation type (rep) is hidden from external clients. Cluster names are global, and no namespace mechanism was provided to group clusters or allow them to be created "locally" inside other clusters. In a cluster, the explicit type conversions ''up'' and ''down'' change between the abstract type and the representation; implicit conversions between these types are signified using the special type ''cvt''. CLU does not otherwise perform implicit type conversions. There is a universal type ''any'', and a procedure force[] to check that an object is a certain type. Objects may be mutable or immutable, the latter being ''base types'' such as integers, booleans, characters and strings.


Other features

Another key feature of the CLU type system are '' iterators'', which return objects from a collection serially, one after another. Iterators offer an identical
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(API) no matter what data they are being used with. Thus the iterator for a collection of complex_numbers can be used interchangeably with that for an array of integers. A distinctive feature of CLU iterators is that they are implemented as coroutines, with each value being provided to the caller via a ''yield'' statement. Iterators like those in CLU are now a common feature of many modern languages, such as C#, Ruby, and Python, though recently they are often referred to as generators. CLU also includes
exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
, based on various attempts in other languages; exceptions are raised using signal and handled with except. Unlike most other languages with exception handling, exceptions are not implicitly resignaled up the calling chain. Also unlike most other languages that provide exception handling, exceptions in CLU are considered part of ordinary execution flow and are considered a "normal" and efficient type-safe way to break out of loops or to return from functions; this allows for direct assignment of return values "except when" other conditions apply. Exceptions that are neither caught nor resignaled explicitly are immediately converted into a special failure exception that typically terminates the program. CLU is often credited as being the first language with type-safe variant types, called ''oneofs'', before the language ML had them. A final distinctive feature in CLU is parallel assignment (multiple assignment), where more than one variable can appear on the left hand side of an assignment operator. For instance, writing x,y := y,x would exchange values of x and y. In the same way, functions could return several values, like . Parallel assignment (though not multiple return values) predates CLU, appearing in CPL (1963), named ''simultaneous assignment'', but CLU popularized it and is often credited as the direct influence leading to parallel assignment in later languages. All objects in a CLU program live in the heap, and memory management is automatic. CLU supports type-parameterized user-defined data abstractions. It was the first language to offer type-safe bounded parameterized types, using ''where clauses'' to express constraints on actual type arguments. Unlike in languages with template-based generics, a use of such a data abstraction can be type-checked without access to the implementation of the abstraction.


Influence

CLU and
Ada Ada may refer to: Places Africa * Ada Foah, a town in Ghana * Ada (Ghana parliament constituency) * Ada, Osun, a town in Nigeria Asia * Ada, Urmia, a village in West Azerbaijan Province, Iran * Ada, Karaman, a village in Karaman Province, T ...
were major inspirations for C++ templates. CLU's exception handling mechanisms influenced later languages like C++ and
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
.
Sather Sather is an object-oriented programming language. It originated circa 1990 at the International Computer Science Institute (ICSI) at the University of California, Berkeley, developed by an international team led by Steve Omohundro. It supports g ...
, Python, and C# include iterators, which first appeared in CLU.
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offic ...
and Lua took multiple assignment and multiple returns from function calls from CLU. Python and
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...
borrowed
call by sharing In a programming language, an evaluation strategy is a set of rules for evaluating expressions. The term is often used to refer to the more specific notion of a ''parameter-passing strategy'' that defines the kind of value that is passed to the ...
, the ''yield'' statement, and multiple assignment.


References


External links

* *
clu2c
a program to compile CLU code to C
Dictionary of Programming Languages


comparison at '99 bottles of beer' multi-language demo algorithm site * {{DEFAULTSORT:Clu (programming language) Academic programming languages Class-based programming languages Massachusetts Institute of Technology software Procedural programming languages Programming languages created in 1975 Programming languages created by women