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!aioe.org!.POSTED.fn3LatRFkm9/xzEj7F2/NQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Tue, 4 Jun 2019 11:33:59 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> NNTP-Posting-Host: fn3LatRFkm9/xzEj7F2/NQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:56457 Date: 2019-06-04T11:33:59+02:00 List-Id: On 2019-06-04 10:24, Maciej Sobczak wrote: >> No. Specification describes a class of implementations. You cannot >> deduce class from its single member. > > So what exactly cannot be deduced? The class. > Please provide some challenging example. Let x be 1. Deduce the set it belongs to. procedure Foo is begin X := 1; -- What are the type of X, 1, end Foo; ---------------- package Objects is type T is mod 45; X : T end Objects; with Objects; use Objects; procedure Foo; ---------------- generic X : in out Integer; procedure Foo; etc. >> It is not possible as well. The language of specifications (to be >> useful) must have statements non-existing in the language of >> implementations. > > Why not put those statements in the implementation file? The compiler should be smart enough to distinguish them. To make programmer's life a bit easier? >> 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. It is not the body. You can put dried leaves between pages of a book. That does not make them text. >> Contract and an implementation of are in two different languages with >> two different domains. They cannot be spelt in a single language. > > What is a single language? A set of keywords with grammar? + semantics. > Your arguments are self-contradictory anyway. What about the package declaration in the some declarative part within the implementation file? That does not change anything in the nature of declarations. They are semantically separate and the programming language should keep this distinction clear. >> Yes, why? There must be something contagious in #ifdef's, or maybe, it >> just what C/C++ inherently is? > > Or maybe this is just what you want it to be, so that Ada looks better? You mean I have that much influence on designers of C/C++ software, who I never met and didn't know they exist? Could I rather switch its focus on bankers? > The problem is - there is nothing stopping you using the same good programming principles and idioms. Especially with regard to physical code design (we have discussed that already (as most of the other things)). You are asking religious questions, why people keep on doing bad things? Though it highlights the difference between specifications (good intentions) and implementations (poor behavior). >>> 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. Ada offers only one. How is this better? >> >> Choice is a burden. > > Yet I know how to benefit from it. And I don't want to resign from it. Yep, that is what they say... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de