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: Mon, 3 Jun 2019 09:57:39 +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: Mon, 3 Jun 2019 07:57:39 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="184530dcbfe5b6d199509f1413974a7d"; logging-data="8599"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sUU9FO4G+9Iwa+HkJGBR7" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 Cancel-Lock: sha1:NHYGevogyWx73eIkyO2QhdU/mug= In-Reply-To: Content-Language: fr Openpgp: preference=signencrypt Xref: reader01.eternal-september.org comp.lang.ada:56438 Date: 2019-06-03T09:57:39+02:00 List-Id: Le 03/06/2019 à 09:35, Maciej Sobczak a écrit : >> That is not possible. You cannot generate specification from >> implementation and conversely. > > Yes, you can. You can generate specs from implementations. > If you have a body with many subprograms, how can you tell which ones are intended to be exported, and which ones are private to the body? >> Compare also Ada's declarative regions with C++'s >> ad-hoc declarations: >> >> declare >> X : Integer; >> begin >> ... -- Some code >> X := 1; >> end; >> >> { >> ... // Some code >> int X; >> X = 1; >> } > > When I compare these two examples, I see that C++ is more readable, because it allows me to minimize the scope of names that are not needed until in later parts of code, without messing with useless constructs like this: > > begin > -- some code > declare > X : Integer; > begin > X := 1; > end; > end; I don't agree. Yes, Ada is more verbose, but it tells you clearly what is a declaration, and what are executable statements. In C/C++ , there is this "Oh, this is a statement, let's assume we have left the declarations part" that I don't like. Granted, it's a matter of taste. -- 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