CLU (programming language)
|This article needs additional citations for verification. (February 2013) (Learn how and when to remove this template message)|
|Paradigm||multi-paradigm: object-oriented, procedural|
|Designed by||Barbara Liskov and her students|
|Developer||Massachusetts Institute of Technology|
|Native CLU, Portable CLU, clu2c|
|ALGOL 60, Lisp, Simula|
|Ada, Argus, C++, Lua, Ruby, Sather, Swift|
CLU is a pioneering programming language created at the Massachusetts Institute of Technology (MIT) by Barbara Liskov and her students between 1974 and 1975. 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 (OOP). However, it is not object-oriented, instead being considered an object-based language, as it lacked many features of OOP.
Key contributions include abstract data types, 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.
The syntax of CLU was based on ALGOL, 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 an "class" in an OO language, and have similar 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;
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.
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, booleans, characters and strings.
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 (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, 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. Exceptions that are neither caught nor resignaled explicitly are immediately converted into a special failure exception that typically terminates the program.
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
y. In the same way, functions could return several values, like
x,y,z = f(t). 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 supported type parameterized user-defined data abstractions. It was the first language to offer type-safe bounded parameterized types, using structure where clauses to express constraints on actual type arguments.
Influence on other programming languages
CLU has influenced many other languages in many ways. In approximate chronological order, these include:
CLU's exception handling mechanisms influenced later languages like C++ and Java.
|This section needs expansion. You can help by adding to it. (June 2008)|
- Curtis, Dorothy (2009-11-06). "CLU home page". Programming Methodology Group, Computer Science and Artificial Intelligence Laboratory. Massachusetts Institute of Technology. Retrieved 2016-05-26.
- Curtis, Dorothy (2009-11-06). "Index of /pub/pclu". Programming Methodology Group, Computer Science and Artificial Intelligence Laboratory. Massachusetts Institute of Technology. Retrieved 2016-05-26.
- Ushijima, Tetsu. "clu2c". clu2c. woodsheep.jp. Retrieved 2016-05-26.
- Lattner, Chris (2014-06-03). "Chris Lattner's Homepage". Chris Lattner. Retrieved 2014-06-03.
The Swift language is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
- Liskov, Barbara; Zilles, Stephen (1974). "Programming with abstract data types". Proceedings of the ACM SIGPLAN symposium on Very high level languages. pp. 50–59. doi:10.1145/800233.807045.
- Liskov, B.; Snyder, A.; Atkinson, R.; Schaffert, C. (August 1977). "Abstraction mechanisms in CLU". Communications of the ACM. 20 (8): 564–576. doi:10.1145/359763.359789. CiteSeerX: 10
.1 .1 .112 .656.
- Barron, D. W.; Buxton, J. N.; Hartley, D. F.; Nixon, E.; Strachey, C. (1963). "The main features of CPL". Computer Journal. 6 (2): 134–143. doi:10.1093/comjnl/6.2.134.
- Ierusalimschy, R.; De Figueiredo, L. H.; Celes, W. (2007). "The evolution of Lua". Proceedings of the third ACM SIGPLAN conference on History of programming languages – HOPL III (PDF). pp. 2–1–2–26. doi:10.1145/1238844.1238846. ISBN 978-1-59593-766-7.