home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.clu
- Path: sparky!uunet!gumby!yale!mintaka.lcs.mit.edu!nntp.lcs.mit.edu!andru
- From: andru@thor.lcs.mit.edu (Andrew Myers)
- Subject: Re: Comparison?
- In-Reply-To: mjohnson@netcom.com's message of 31 Dec 92 20:25:52 GMT
- Message-ID: <ANDRU.93Jan4144519@thor.lcs.mit.edu>
- Sender: news@mintaka.lcs.mit.edu
- Organization: /u/andru/.organization
- References: <9212311409.AA27039@netcom.netcom.com>
- Date: Mon, 4 Jan 1993 19:45:19 GMT
- Lines: 35
-
- In article <9212311409.AA27039@netcom.netcom.com> mjohnson@netcom.com (Mark Johnson) writes:
-
- What are the main differences in the approach toward objects
- between CLU and G++ ?
-
- Thank you, MJ
-
-
- There are many differences between the concepts of objects in CLU
- and C++ (G++ doesn't differ from C++ in this respect). Off the top
- of my head:
-
- 1. CLU objects are always allocated on the heap, whereas C++ objects
- may be stack-allocated. As a byproduct of this, C++ has the types
- "T &" and "T *" for (most) any type "T".
- 2. CLU objects are garbage-collected. C++ objects must be explicitly
- deallocated.
- 3. C++ has subtyping on pointer and reference types, and inheritance.
- CLU has no subtyping, though its abstraction mechanism does share
- the identity-preserving aspect of the usual inheritance mechanisms.
- 4. CLU's parameterized types are more powerful, since
- they can be used like functions to generate new types. Typechecking
- of C++ templates is done at instantiation time, but CLU parameterized
- clusters can be typechecked before instantiation because of the
- "where" clauses.
- 5. The CLU methodology of abstraction only allows type operations to
- be visible from the outside. C++ allows fields (member variables)
- to be visible as well. C++ class declarations are forced to mention
- all members of the type, even if they are private. CLU declarations
- can only mention public operations.
- 6. Variables in CLU are pointers to objects, and assignment is a special
- statement form. Variables in C++ are containers for objects, and
- assignment is a member function (method).
-
- Andrew
-