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!
== 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/>
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)