CLU (programming language)

CLU (programming language)

Infobox programming language
name = CLU

paradigm = multi-paradigm: object-oriented, procedural
year = 1974
designer = Barbara Liskov and her students at MIT
developer = Barbara Liskov and her students at MIT
latest release version =
latest release date =
typing = strong
implementations = [ Portable CLU] , [ Native CLU] , [ clu2c]
dialects =
influenced_by = Pascal
influenced = Ruby

CLU is a programming language created at MIT by Barbara Liskov and her students between 1974 and 1975. It was notable for its use of constructors for abstract data types that included the code that operated on them, a key step in the direction of object-oriented programming (OOP). However many of the other features of OOP are missing or incomplete, notably inheritance, and the language is also hindered by a sometimes frustrating syntax. CLU and Alphard both seem to get as close as possible to being a full OO language without actually being one.


The syntax of CLU was based on ALGOL, then the starting point for most new language design. 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 an "object" in an OO language, and have roughly the same syntax. For instance, here is the CLU syntax for a cluster that implements 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;

While clusters offered a then-advanced system for structuring programs, CLU did not offer any sort of structure for the clusters themselves. Cluster names are global, and no namespace mechanism was provided to group clusters or allow them to be created "locally" inside other clusters. This problem is not unique to CLU, but it is surprising that so many languages have lacked this feature — given the centralness in ALGOL of giving scope to variables, it seems that giving scope to cluster/object names would be an obvious extension.

CLU does not perform implicit type conversions. In a cluster, the explicit type conversions 'up' and 'down' change between the abstract type and the representation. 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.

Other features

Another key feature of the CLU type system are "iterators", which return objects from a collection one after the other. Iterators were "black boxes" that offered an identical API no matter what data they were being used with. Thus the iterator for a collection of complex_numbers would be identical to that for an array of integers. Iterators are now a common feature of most modern languages. "(See Generator)"

CLU also includes exception handling, based on various attempts in other languages; exceptions are raised using signal and handled with except. Oddly, given the focus on type design, CLU does not offer enumerated types, nor any obvious way to create them.

A final distinctive feature in CLU is 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 x,y,z = f(t).

All objects in a CLU program live in the heap, and memory management is automatic.


* Clu was the name of Kevin Flynn's program avatar in the 1982 cult classic film "Tron".

Influence on other programming languages

* Python and Ruby borrowed several concepts from CLU (such as the "yield" statement and multiple assignment). It is not true that the "yield" of Ruby works like CLU, as Ruby does not use coroutines in implementing "yield".
* CLU and Ada were major inspirations for C++ templates.
* CLU's exception handling mechanisms also influenced newer languages like Java and C++.
* All objects in a CLU program live in the heap, and memory management is automatic. These elements directly influenced Java.
* Python and C# include generators (iterators in C#), which first appeared in CLU as iterators.
* Lua took multiple assignment and multiple returns from function calls from CLU.

External links

* [ CLU Home Page]
* [ A History of CLU] (pdf)
* [ clu2c] : a program to compile CLU code to C
* [ Dictionary of Programming Languages]
* [ CLU] comparison at '99 bottles of beer' multi-language demo algorithm site

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • CLU — The term CLU can refer to a number of things: * Communion and Liberation University Students * The CLU programming language * The financial professional designation Chartered Life Underwriter overseen by The American College. * California… …   Wikipedia

  • Language C++ — C++ Apparu en 1985 (dernière révision en 2003) Auteur Bjarne Stroustrup …   Wikipédia en Français

  • List of programming languages by category — Programming language lists Alphabetical Categorical Chronological Generational This is a list of programming languages grouped by category. Some languages are listed in multiple categories. Contents …   Wikipedia

  • Object-oriented programming — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computing …   Wikipedia

  • Comparison of programming languages — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Generic programming — is a style of computer programming in which algorithms are written in terms of to be specified later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983. This… …   Wikipedia

  • History of Programming Languages conference — HOPL (History of Programming Languages) is an infrequent ACM SIGPLAN conference. Past conferences were held in 1979, 1993, and 2007. HOPL I HOPL I was held June 1 ndash;3, 1979 in Los Angeles, California. Jean E. Sammet was both the General and… …   Wikipedia

  • Клу — Класс языка: Объектно ориентированный, процедурный Тип исполнения: Компилируемый Появился в: 1974 Автор(ы): Барбара Лисков Расширение файлов …   Википедия

  • Ruby — Класс языка: мультипарадигмальный: динамический, объектно ориентиров …   Википедия