From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,8be18979db11f51c X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,fb631c9316319fef X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-02-28 18:26:07 PST Path: supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!news.tele.dk!195.158.233.21!news1.ebone.net!news.ebone.net!newsfeed2.news.nl.uu.net!sun4nl!not-for-mail Message-ID: <3A9DB337.6F595A3C@infopuls.com> Date: Thu, 01 Mar 2001 02:25:59 +0000 From: Christof Brass Organization: InfoPuls X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.0.36 i586) X-Accept-Language: de MIME-Version: 1.0 Newsgroups: comp.os.vms,comp.sys.dec Subject: Re: Drop C/C++ better sooner than later References: <87n1baae6s.fsf@prep.synonet.com> <97bm3a$7tv@gap.cco.caltech.edu> <3A99AED0.5DF07890@infopuls.com> <97cd06$hcn$1@pyrite.mv.net> <97egck$vc6$3@info.cs.uofs.edu> <3A9AEFCD.AFC8431@infopuls.com> <97etsu$j41$1@pyrite.mv.net> <3A9B023A.CBD414A5@infopuls.com> <97hvro$hj4@freepress.concentric.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cache-Post-Path: fuchs.cyberlink.ch!unknown@193.247.146.165 X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) NNTP-Posting-Host: 193.246.253.18 X-Trace: 983413433 news.ch.uu.net 178 193.246.253.18 Xref: supernews.google.com comp.os.vms:20631 comp.sys.dec:2946 Robert Deininger wrote: > > In article <97hvro$hj4@freepress.concentric.net>, "Rick Cadruvi" > wrote: > > > > > > > But I think that is fine: > > > > > > if WINE = RED > > > then > > > .... > > > elsif SIZE > 500 > > > then > > > .... > > > elsif AGE /= 17 > > > then > > > .... > > > else > > > .... > > > end if; > > > > Your example is fine. I am talking about something like: > > > > if () > > {if () > > { > > } > > else > > { > > if > > { > > } > > else > > { > > } > > } > > } > > else > > > > Its the extra nesting that gets problematic. Your example doesn't > > display that type of behavior. > > Well, the C if is particularly weak, and brackets for statement grouping > are error-prone. The Ada if is more robust and expressive. In Ada, small > syntax errors are easier for the compiler to isolate and flag. The > "elsif" construct reduces nesting depth in many situations. > > The if statement was one of the many points where the Ada designers tried > to correct syntactic blunders from previous languages. > > "elsif" is an interesting example. "else if" and "elsif" mean quite > different things (the former starts another level of nesting). They could > have chosen "elseif" instead of "elsif", since blanks are significant in > Ada. But that would have been hell on all the Fortran programmers, who > can't tell the difference between ELSEIF and ELSE IF. In Ada, where line > breaks are NOT significant, omitting the space might have been correct, or > and error, but the compiler would not know which until the end of the > whole block-if construct. The strangely-spelled "elsif" localizes what is > a common typo for folks used to some other languages. > > > Even still, I would probably use other constructs like > > a switch case statement or something. > > I'd tend to agree with you in C, where the if is feeble. In Ada, the > if-elsif-else construct is the right one in most cases. In Larry's > example, where the IF involves 3 different variables (WINE, SIZE, and > AGE), CASE won't work. > > And if you need a nested if-else in both the if part and the else part, a > switch isn't simple anymore. > > > > > Teach programmers to write code well, and new progrmaming languages will > > > > evolve that help us solve the problems better and not ones that prevent > > us > > > > from > > > > doing things we shouldn't do in the first place unless they are REALLY > > > > required. > > > > > > But we seem to disagree on what constitutes well-written. > > > > Can we at least agree that if programmers were taught to write good code in > > the first place then a lot of the problems some languages try to solve would > > be less > > of an issue? > > Yes, I'll agree with that any time. It's a problem that won't go away > anytime soon. I think it's getting worse. (That must be a sign of > oldness.) > > There have been some fairly unbiased side-by-side comparisons of > productivity with C vs. Ada, at various programmer skill levels. Ada > comes out ahead, usually by a large margin. It seems to take a bit longer > to write, but much less time to debug. > > In the modern world, where bugs don't matter, Ada is at a disadvantage. > > -- > Robert Deininger > rdeininger@mindspring.com I know of a long term comparison in practice where Ada came out at least twice as good. I don't understand what you mean with "bit longer to write, but much less time to debug" because first level testing/debugging is part of writing. Otherwise I could use a language which is almost insensitive to what I feed into the compiler/interpreter. I know several people who use Pascal or C. If can compile a Pascal program you have done 50% of your work. If you can compile your C program you have done 20% of your work.