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!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Sun, 2 Jun 2019 07:42:58 +0200 Organization: Adalog Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 2 Jun 2019 05:42:58 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="2ad8bd664d9589d3f1fa8baf5a0e6b6e"; logging-data="9459"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19t1Jbr0lr+6d6wu9A2rDqZ" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 Cancel-Lock: sha1:c/hzTLtkugA8Vemun04KmWl6JbI= In-Reply-To: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> Content-Language: fr Openpgp: preference=signencrypt Xref: reader01.eternal-september.org comp.lang.ada:56432 Date: 2019-06-02T07:42:58+02:00 List-Id: Le 02/06/2019 à 02:48, John Perry a écrit : > I understand that Ada, like Modula-2 and Modula-3, and arguably like > C++, requires a definition file (.ads) as well as an implementation > file (.adb). With Oberon, Wirth moved away from definition files, > using a symbol to indicate which module identifiers should be > exported. (Someone else may have done this before him; it's just that > I'm most familiar with this history.) Most languages I'm familiar > with these days do something similar, either via public/private or > some other mechanism. > > As far as I can tell, though, Ada has stuck with the two separate > files, rather than, say, generating an .ads from an .adb with export > markup. > > Is there a reason Ada hasn't moved to this simpler structure? > Yes. Because it is by far superior. One of the main (huge) benefits of Ada is in being able to use specifications even before the body exists. You can: 1) write the specification, compile it to make sure that it make sense 2) write the code that uses the specification, to make sure that the specification meets the needs of the using code 3) Write the body, with the assurance that what you do is the right thing. You can even add: 2.5) write a prototype body to check that the behaviour is correct, before writing the full body that meets all requirements. As a teacher, I keep fighting with students who jump to writing bodies too early. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr