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:a02:85ef:: with SMTP id d102mr27638953jai.63.1559739492349; Wed, 05 Jun 2019 05:58:12 -0700 (PDT) X-Received: by 2002:aca:805:: with SMTP id 5mr3102931oii.99.1559739492139; Wed, 05 Jun 2019 05:58:12 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!i64no144506iti.0!news-out.google.com!l126ni131itl.0!nntp.google.com!i64no144499iti.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 5 Jun 2019 05:58:11 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=165.225.84.81; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S NNTP-Posting-Host: 165.225.84.81 References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> <87woi0xtwm.fsf@nightsong.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: Wed, 05 Jun 2019 12:58:12 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56486 Date: 2019-06-05T05:58:11-07:00 List-Id: > On the other hand, I like it that I can get a first impression of an Ada= =20 > program by reading just the .ads files. This. This is important. I have seen the suggestion to treat spec files as a low-level requirements = document, to be completed by the body. This is a convincing argument for ke= eping these files separate. But on the other hand, there are coding patterns that achieve the same effe= ct without distinguishing between spec and implementation. The interface de= sign pattern does it, for example. This is exactly how Java programmers ach= ieve decoupling - but note that this is a voluntary action, so can be also = limited to only those places where it is actually needed. Say, I need this idiom in 10% of packages. Why am I penalized in the remain= ing 90% and forced to write specs that are demonstrably not needed? In particular, it is very difficult to explain this concept to beginners, b= ecause in simple examples the redundancy of syntax is just shocking - the p= ackage spec looks like copy-paste of signatures; and arguably this is how s= ome of the specs are born in practice. The language that forces me to copy-= paste stuff between files is not inviting me to study it more deeply. What we are discussing is whether this copy-pasting has added values that j= ustify the costs. > Apart from all the other reasons already given, keeping spec and body in= =20 > the same file can cause compilation-order problems. Only if you assume that the compiler reads the file only once and therefore= must validate everything in a single pass. Which is not the case anyway, not even in Ada (nor in C++). That's why this= concept looks a bit archaic today. --=20 Maciej Sobczak * http://www.inspirel.com