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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d275ffeffdf83655 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Ada vs C++ vs Java Date: 1999/02/06 Message-ID: #1/1 X-Deja-AN: 441435624 References: <369C1F31.AE5AF7EF@concentric.net> <369DDDC3.FDE09999@sea.ericsson.se> <369e309a.32671759@news.demon.co.uk> <77ledn$eu7$1@remarQ.com> <77pnqc$cgi$1@newnews.global.net.uk> <8p64spq5lo5.fsf@Eng.Sun.COM> <77t3ld$nou$1@nnrp1.dejanews.com> <79ce4s$lfq$1@nnrp1.dejanews.com> <79chc7$ko6@drn.newsguy.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 918328719 16691 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-06T00:00:00+00:00 List-Id: I've axed all newsgroups but comp.lang.ada, since I don't crosspost anymore, and my response is Ada-centric... On 4 Feb 1999, mike wrote: > In article <79ce4s$lfq$1@nnrp1.dejanews.com>, mll@xmission.com says... > > > >HERE HERE, I've been writing C for 17 years, C++ for 7 and Ada for 7 and > >would select Ada over the other 2 anytime (there may be SOME?? applications > >which would be better written in C). I like Ada better too. > C++, with the standard library is as reliable as Ada, with the addition > that it is more terse. More terse, arguably true, more reliable, in my experience quite false. > Look at this code below posted here recently by another poster. This code > sorts a list of names inputed from stdin, look how clear, short, > elegent, and easy to read it is. ^^^^^^^^^^^^^^^^^^^^^^ This is the point which I've made before with respect to automatic instantiation, which is a matter of debate. I agree with Mike here, that the absence of lots of instantiations is a boon to *readability* here, and the large numbers of instantiations that a similar generic library in Ada appear as so much noise (like the "_Type" in type names for some people ;-) which makes code much worse to read. Matthew Heaney points out that Ada provides a tiny bit of help by allowing you to omit some parameters, but the key bit of help C++ provides is the automatic instantiation. > try to do the same in Ada (actually Ada does not even have a standard > generic library that comes with the compiler as C++ does), and you might > end up with pages of long code that is hard to read. Well, your argument is weak here. The advantage of C++ is not even that it comes with such a library, but that using the library doesn't incur the excessive wordiness cost. An Ada STL will still be less concise than a C++ one, and less readable in this regard. OTOH, Ada generics are far more safe than C++ templates, as type constraints are built into Ada generics. C++ templates support unconstrained parametric polymorphism, as opposed to Ada's support for constrained pp. > I dont think Ada is more read'able. I think wordy languages for me > are harder to read. too much words makes thing less hard to understand. This doesn't parse. I know what you're trying to say, but your final sentence above says the opposite! I think that readability involves trade-offs. There is a "sweet spot" in the concise vs verbose space that neither Ada nor C++ optimizes, though IMO Ada is *far*, *far*, closer. But, a little automatic instantiation would move it closer still! > Ada offcourse is a fine langauage. but I feel C++ is more expressive > and concise. and in the practical world, it is easier to use than Ada. C++ cannot express concurrency, so how is it more expressive? If anything, I can express much more in Ada than in C++! > C++ now, after becoming a standard, and with the standard library is a > very safe language. No, sorry, Tucker Taft had it right. With hard work, you can make write relatively safe C++, but the defaults are all unsafe. With a bit of effort, you can write unsafe Ada, but the defaults are safe. I prefer the Ada way. I think what many Ada proponents missed in this post was that this example demonstrates how automatic instantiation can lead to short and *readable* code sections. -- Brian > #include > #include > #include > #include > > int main() > { > cout << "Please enter a list of words to be sorted: "; > > vector v; > string buffer; > while (cin>>buffer && buffer!="END") v.push_back(buffer); > > sort(v.begin(),v.end()); > > for (vector::iterator i = v.begin(); i!=v.end(); ++i) > cout << *i << endl; > > return 0; > } > > mike > >