ArticleslgStudy

computer science

CLU (programming language)

CLU (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand CLU (programming language) rather than just read about it. In short: CLU is a class-based programming language created at the Massachusetts Institute of Technology (MIT) by Barbara Liskov and her students starting in 1973. 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).

Key takeaways

  • CLU (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect CLU (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of CLU (programming language) from memory before moving on to harder problems.

Reference excerpt

CLU is a class-based programming language created at the Massachusetts Institute of Technology (MIT) by Barbara Liskov and her students starting in 1973. 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). 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.

Clusters 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 a "class" in an OO language. For instance, here is the CLU syntax for a cluster that implements complex numbers:

A cluster implements a data abstraction, which is a set of objects and a set of primitive operations to create and manipulate those objects. 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 (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. 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 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 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 were major inspirations for C++ templates. CLU's exception handling mechanisms influenced later languages like C++, Java and many others. Sather, Python, and C# include iterators, which first appeared in CLU. Perl and Lua took multiple assignment and multiple returns from function calls from CLU. Python and Ruby borrowed call by sharing, the yield statement, and multiple assignment.

References

External links Official website Liskov, Barbara (April 1992). "A History of CLU" (PDF). MIT-LCS-TR-561. Archived from the original (PDF) on 2003-09-17. 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

Worked examples

Example 1 — a first encounter with CLU (programming language)

Start with the simplest possible case. Write down what CLU (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to CLU (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about CLU (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of CLU (programming language)

In research
CLU (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses CLU (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
CLU (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Academic programming languages, Articles with example CLU code, Class-based programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for CLU (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “CLU (programming language)” →

How to study CLU (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what CLU (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain CLU (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is CLU (programming language) in simple terms?

CLU is a class-based programming language created at the Massachusetts Institute of Technology (MIT) by Barbara Liskov and her students starting in 1973. 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-ori…

Why does CLU (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study CLU (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on CLU (programming language).

Tags

  • Academic programming languages
  • Articles with example CLU code
  • Class-based programming languages
  • Massachusetts Institute of Technology software
  • Procedural programming languages
  • Programming languages created by women
  • Programming languages created in 1975

Keep exploring