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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:6602:2256:: with SMTP id o22mr11838507ioo.95.1559636652143; Tue, 04 Jun 2019 01:24:12 -0700 (PDT) X-Received: by 2002:a05:6830:2151:: with SMTP id r17mr4101323otd.240.1559636651966; Tue, 04 Jun 2019 01:24:11 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!g15no9133itd.0!news-out.google.com!l126ni150itl.0!nntp.google.com!i64no153771iti.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 4 Jun 2019 01:24:11 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.9.245.42; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S NNTP-Posting-Host: 194.9.245.42 References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Why .ads as well as .adb? From: Maciej Sobczak Injection-Date: Tue, 04 Jun 2019 08:24:12 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56456 Date: 2019-06-04T01:24:11-07:00 List-Id: > No. Specification describes a class of implementations. You cannot=20 > deduce class from its single member. So what exactly cannot be deduced? Please provide some challenging example. > It is not possible as well. The language of specifications (to be=20 > useful) must have statements non-existing in the language of=20 > implementations. Why not put those statements in the implementation file? The compiler shoul= d be smart enough to distinguish them. > No. The right statement would be: I cannot write contract in the body. Why? The text editor should not stop you and the compiler should figure out= which is which. > Contract and an implementation of are in two different languages with=20 > two different domains. They cannot be spelt in a single language. What is a single language? A set of keywords with grammar? I can invent the= keywords and grammar to cover both needs. Heck, it was already invented, j= ust write them in a single file. Your arguments are self-contradictory anyway. What about the package declar= ation in the some declarative part within the implementation file? I can ev= en declare a helper package in the subprogram scope (in its declarative par= t), so all arguments about the necessity to keep specs and implementation f= iles separate, on the basis that they must be separate "languages", are poi= ntless anyway. Ada already allows to mix everything together, so why preten= ding to be so pure? The purity is gone already. > The gain is definition of the scope. C++ equivalent, which I would force= =20 > in each C++ programming guideline, would be: >=20 > { > ... // Some code > { > int X; > X =3D 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 gai= n. Still (in both variants), C++ is more readable (the proportion of useful co= de to the whole is higher). > Yes, why? There must be something contagious in #ifdef's, or maybe, it=20 > just what C/C++ inherently is? Or maybe this is just what you want it to be, so that Ada looks better? The problem is - there is nothing stopping you using the same good programm= ing principles and idioms. Especially with regard to physical code design (= we have discussed that already (as most of the other things)). > > In other words: for multiplatform development, C++ gives me 2 solutions= and I can choose the one which is more beneficial in the given context. Ad= a offers only one. How is this better? >=20 > Choice is a burden. Yet I know how to benefit from it. And I don't want to resign from it. --=20 Maciej Sobczak * http://www.inspirel.com