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 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a8985ede8fe3d111 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-03 19:56:32 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!darwin.sura.net!news.sesqui.net!uuneo.neosoft.com!Starbase.NeoSoft.COM!not-for-mail From: dweller@Starbase.NeoSoft.COM (David Weller) Newsgroups: comp.lang.ada Subject: Re: Is Ada the future? [was: Is C++ the future?] Date: 3 Oct 1994 19:29:57 -0500 Organization: NeoSoft Internet Services +1 713 684 5969 Message-ID: <36q7m5$4ef@Starbase.NeoSoft.COM> References: <36msgr$qq2@Starbase.NeoSoft.COM> NNTP-Posting-Host: starbase.neosoft.com Date: 1994-10-03T19:29:57-05:00 List-Id: In article , John DiCamillo wrote: >dweller@Starbase.NeoSoft.COM (David Weller) writes: >>In article , Robin Rowe wrote: >>><< In the meantime, I have a responsibility to write reliable software. >>>Ada 9X does that for me in ways that C++ folks are now only dreaming >>>about. >> >>>What Ada 9X dreams am I supposed to be having? How about a >>>list of ways that Ada 9X can make more reliable software >>>than C++? >>Is this a serious question? > >If it wasn't I'll second it and make it one. > >> Range checking, >Trivially provided in C++ classes that need it. > We must have wildly different opinions of "trivial" then. The problem with C++ is that it requires the programmer to write defensively. "Caveat hackus", if you will. Type checking, for instance, is provided only at the class level. It's not possible to create an integer of type Oranges and one of Apples without artificially mashing them into classes and then going through an array of gyrations to overload all operations. The typedef is merely a synonym, not a new type. This is so fundamental to the difference between Ada and C++ that I dare say it's the root of misunderstanding between the two "camps" (if one feels compelled to segregate the two -- I write in both languages, so I guess I'm a pariah :-). The fundamental issue is this: Ada starts from the side of reliability and requires the programmer to unravel the safety where needed. C++ starts from the side of "flexibility" (lack of safety, depending on your perspective :-) and forces the programmer to wrap up their nugget of data (members) with a layer of protection (classes). >> Type checking within generics, >C++ provides this for every definition of that >phrase that I can think of. I can only assume >that you mean something else. Please elaborate. > Templates: Grrrrr. Write a class template. Then repeat the template parameters _everywhere_. Repeat them in your parameter lists, repeat them in your member functions, repeat them in your declarations. "Ad naseum" is an understatement. What's that got to do with reliability? Not a damn thing, but it makes a BIG difference in readability. Again, type checking is loose, both in creation and elaboration of templates. I owe you a better explanation on this one, but I'm short on time right now (should be doing my work on the Booch Component translation). >> safe pointers >Can be provided, but not legislated. In any >case, for programs of more than trivial com- >plexity, raw pointers are generally wrapped >in safe classes. The real problem is refer- >ences to temporaries. > No. As an Ada person, I see "The Real Problem" as being that C++ is horribly unsafe. Wrap a pointer in a class and protect it? Well, so much for simplicity.... As for references to temps...well, I'm just happy I'm working with a language that has a little better definition of "closure" :-) >> etc. >Oh, now *this* one is *definately* provided >by C++. In spades! ;-> More seriously, >have ya got anything else? > Yes, but out of time (as mentioned before). I _do_ owe you a better explanation (I sure wouldn't be convinced by my reply here alone). Maybe others can chime in without letting this turn into a language flamewar (I know, I'm probably asking too much :-) Before you think I'm a rabid C++ hater -- I sometimes find the "flexibility" of C++ liberating. I don't, however, recommend it over Ada 9X. -- Proud (and vocal) member of Team Ada! (and Team OS/2) ||This is not your Ada -- Very Cool. Doesn't Suck. || father's Ada For all sorts of interesting Ada tidbits, run the command: ||________________ "finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.) ObNitPick: Spelling Ada as ADA is like spelling C++ as CPLUSPLUS. :-)