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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Tue, 4 Jun 2019 17:28:55 -0500 Organization: JSA Research & Innovation Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> Injection-Date: Tue, 4 Jun 2019 22:28:56 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="18087"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:56477 Date: 2019-06-04T17:28:55-05:00 List-Id: "Maciej Sobczak" wrote in message news:f37f6f75-62d4-4152-917e-d666d67f6cb7@googlegroups.com... ... >> The gain is definition of the scope. C++ equivalent, which I would force >> in each C++ programming guideline, would be: >> >> { >> ... // Some code >> { >> int X; >> X = 1; >> .. >> } >> .. // Some code >> } > >This is useful if there is a reason to not have X in the second "Some code" >part. >Especially if X is handling some resource. Otherwise there is no gain. >Still (in both variants), C++ is more readable (the proportion of useful >code to >the whole is higher). There's a lot more to readability than just the "proportion of useful code". Indeed, it is rather important that delimiters be clear and not get lost in the code. That's the main fault of C family syntax, critical closings get lost (as it is a single skinny character, barely noticiable in most fonts); it's hard to tell the difference between that and a blank line in the above. (Remember that "some code" is likely to be a fairly large block with more {} of it's own.) And C-family code with } on separate lines is a rarity -- most of it is all smushed together (more like we'd write parens in Ada). Ada strikes the critical balance between readability and consiseness. And it pretty much is the only language where the language designers truly cared about readability (not just in the syntax, but also in how the semantics impacts readability), and designed the syntax with readability in mind. Most language designers only pay a small amount of attention to readability and just design the syntax as a vessel for their semantics. And the results show it. Indeed, the reason to choose Ada is the synergy between the syntax and semantics. An conglomeration would not work as well: Ada syntax and C++ semantics, or C++ syntax and Ada semantics would both be substantially less readable than Ada is. Ada's syntax is not perfect, of course, but it is as close as has been designed to date (at least of the many languages I know about). Particularly the original Ada 83 part (I don't think we've always managed to add new features in the best possible way). Randy.