Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
CLU (programming language)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
== 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).<ref name=Liskov1977>{{Cite journal |last1= Liskov |first1= B. |author-link1= Barbara Liskov |last2= Snyder |first2= A. |last3= Atkinson |first3= R. |last4= Schaffert |first4= C. |title= Abstraction mechanisms in CLU |doi= 10.1145/359763.359789 |journal= [[Communications of the ACM]] |volume= 20 |issue= 8 |pages= 564β576 |date=August 1977 |citeseerx=10.1.1.112.656 |s2cid= 17343380 }}</ref> 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 number]]s: <!-- Not actually Algol 68, but this attribute is required--> <syntaxhighlight lang="text"> 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; </syntaxhighlight> 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 conversion]]s. 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.<ref name=Liskov1977/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
CLU (programming language)
(section)
Add topic