From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!GE-CRD.ARPA!WELTY From: WELTY@GE-CRD.ARPA.UUCP Newsgroups: comp.lang.ada Subject: Re: C++ as a way to use private types in C Message-ID: <8704010054.AA00265@ucbvax.Berkeley.EDU> Date: Tue, 31-Mar-87 12:08:00 EST Article-I.D.: ucbvax.8704010054.AA00265 Posted: Tue Mar 31 12:08:00 1987 Date-Received: Fri, 3-Apr-87 01:20:19 EST Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet List-Id: Date: 31-MAR-1987 11:58 From: Richard Welty Sender: WELTY Subject: Re: C++ as a way to use private types in C To: info-ada@ada20.isi.edu@smtp -------- > ihnp4!chinet!nucsrl!gore@ucbvax.Berkeley.EDU (Jacob Gore) writes: >/ nucsrl:comp.lang.ada / WELTY@GE-CRD.ARPA (WELTY RICHARD P) / >> Objects in C++ (like objects in Flavors, CommonLoops, Smalltalk, etc.) >> may be dynamically allocated and freed -- Ada Generics are a somewhat >> weaker notion. > >I'm not sure what you mean here. My understanding is that you can instantiate >a generic within a scope, thus "dynamically allocating" it. When you leave >the scope, it's gone, "dynamically freed"... sort of. If the instance has >allocated heap space during its life, that space is not deallocated >automatically, but becomes the garbage collector's problem. What I meant was that the objects are reasonably independent of scope -- I can allocate and free them in the course of normal execution, allocate n of them inside of a loop, pass pointers to them, etc. Ada has a distinctly different style for handling this sort of thing. You can use a package to contain the type declaration for some object you want to declare along with the functions for access to it. In a system like C++, the functions are considered to be a part of the object. The resulting language has a lot of interesting properties when it comes to things like scoping ... -- Richard Welty (welty@ge-crd.arpa) --------