home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / clu / 8 < prev    next >
Encoding:
Text File  |  1993-01-04  |  2.0 KB  |  48 lines

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