Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
CLU (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Other features == Another key feature of the CLU type system are ''[[iterator]]s'', which return objects from a collection serially, one after another.<ref name=Liskov1977 /> Iterators offer an identical [[application programming interface]] (API) no matter what data they are being used with. Thus the iterator for a collection of <code>complex_number</code>s can be used interchangeably with that for an array of <code>integer</code>s. 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 <code>signal</code> and handled with <code>except</code>. 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 type]]s, called ''oneofs'', before the language [[ML (programming 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 (computer science)|assignment]] operator. For instance, writing <code>x,y := y,x</code> would exchange values of <code>x</code> and <code>y</code>. In the same way, functions could return several values, like {{CLU|1=x,y,z := f(t)}}. Parallel assignment (though not multiple return values) predates CLU, appearing in [[CPL (programming language)|CPL]] (1963), named ''simultaneous assignment'',<ref>{{cite journal |first1= D. W. |last1= Barron |first2= J. N. |last2= Buxton |first3= D. F. |last3= Hartley |first4= E. |last4= Nixon |first5= C. |last5= Strachey |title= The main features of CPL |journal= Computer Journal |volume= 6 |issue= 2 |pages= 134β143 |date= 1963 |doi= 10.1093/comjnl/6.2.134|doi-access= free }}</ref> 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 [[generic programming|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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)