Programming Language Clu

CLU is a 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).

CLU
Paradigmmulti-paradigm: object-oriented, procedural
Designed byBarbara Liskov and her students
DeveloperMassachusetts Institute of Technology
First appeared1975; 49 years ago (1975)
Stable release
Native CLU 1.5 (SPARC, VAX) / May 26, 1989; 34 years ago (1989-05-26)

Portable CLU / November 6, 2009; 14 years ago (2009-11-06)

Typing disciplinestrong
Websitepmg.csail.mit.edu/CLU.html
Major implementations
PDP-10 CLU, Native CLU, Portable CLU, clu2c
Influenced by
ALGOL 60, Lisp, Simula, Alphard
Influenced
Ada, Argus, C++, Lua, Python, Ruby, Sather, Swift

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:

    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 (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++ and Java.[citation needed]

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

Tags:

Programming Language Clu ClustersProgramming Language Clu Other featuresProgramming Language Clu InfluenceProgramming Language CluBarbara LiskovMassachusetts Institute of TechnologyObject-oriented programmingProgramming language

🔥 Trending searches on Wiki English:

U.S. stateFrance national football teamThe Ministry of Ungentlemanly WarfareDragon's Dogma 2September 11 attacksPremier LeagueBrad PittJ. Robert OppenheimerKylian MbappéNinja (gamer)Piyush ChawlaBob DylanLionel MessiRoad House (1989 film)ChaturbateBrooklynElizabeth TaylorUnited States Supreme Court BuildingSpain national football teamKobe BryantBaltimoreJeffrey HunterDune (franchise)Marilyn MonroeDavid DastmalchianX (2022 film)GermanyGame of ThronesList of states and territories of the United StatesAnsel AdamsTulsi GabbardSeven deadly sinsGeorge W. Bush2024 Formula One World ChampionshipJulia RobertsDavid BeckhamHarold RamisList of most-streamed artists on SpotifyNapoleonIslamic State – Khorasan ProvinceWashington, D.C.Maya RudolphInterstate 695 (Maryland)Elizabeth HolmesMosesIslamic StateOnlyFansJohn F. KennedyLate Night with the DevilPreity ZintaEngland national football teamJude BellinghamJosh DoanTeri Baaton Mein Aisa Uljha JiyaAnthony KiedisCarol BurnettPete ButtigiegPortugalJean-Michel BasquiatMonacoBruce SpringsteenMadisyn ShipmanRebecca FergusonGeorge WashingtonGhostbustersItalyJustin BieberJordan CameronHarvey WeinsteinTante2024 Andhra Pradesh Legislative Assembly electionDua LipaTrue Detective (season 4)Comstock lawsWinston ChurchillAaron HernandezKanye West🡆 More