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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ea5071f634c2ea8b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.35.68 with SMTP id f4mr9465500pbj.5.1322174927184; Thu, 24 Nov 2011 14:48:47 -0800 (PST) Path: lh20ni14294pbb.0!nntp.google.com!news1.google.com!postnews.google.com!i6g2000vbe.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Generic-Package Elaboration Question / Possible GNAT Bug. Date: Thu, 24 Nov 2011 14:48:46 -0800 (PST) Organization: http://groups.google.com Message-ID: <011f483a-e0d7-4475-89e6-506802e88b9b@i6g2000vbe.googlegroups.com> References: <7bf9bc32-850a-40c6-9ae2-5254fe220533@f29g2000yqa.googlegroups.com> <4295dc09-43de-4557-a095-fc108359f27f@y42g2000yqh.googlegroups.com> <3snehoqgs8ia$.1nobjem6g6hx6$.dlg@40tude.net> <128rdz2581345$.c4td19l7qp9z$.dlg@40tude.net> <16ipwvpdavifr$.17bxf7if7f6kh$.dlg@40tude.net> <4ecb78b1$0$6643$9b4e6d93@newsspool2.arcor-online.net> <1iofgbqznsviu$.phvidtvxlyj4$.dlg@40tude.net> <4ecbb96e$0$6581$9b4e6d93@newsspool3.arcor-online.net> <743e83a1-c442-444b-a25a-da706e9cd0f9@g7g2000vbd.googlegroups.com> NNTP-Posting-Host: 24.230.151.194 Mime-Version: 1.0 X-Trace: posting.google.com 1322174927 5464 127.0.0.1 (24 Nov 2011 22:48:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 24 Nov 2011 22:48:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i6g2000vbe.googlegroups.com; posting-host=24.230.151.194; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe) Xref: news1.google.com comp.lang.ada:19126 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-24T14:48:46-08:00 List-Id: On Nov 24, 4:10=A0am, "Dmitry A. Kazakov" wrote: > On Wed, 23 Nov 2011 19:07:55 -0800 (PST), Shark8 wrote: > > On Nov 22, 10:23=A0am, "Dmitry A. Kazakov" > > wrote: > >> I don't care about trade marks and definitions given by reference > >> manuals... > > > Why not; definitions are essential to understanding each other. > > If someone saying 'hammer' means 'shotgun' then what does "I need a > > hammer." mean? > > That is the reason. TM and RM are inclined to name hammer shotgun. > > DbC (TM) considerably deviates from design by contract (common sense), Unfortunately "common sense" is not intuitively obvious to everyone; furthermore, "common sense" is hampered by the fact that natural- language tends to contain connotations not within the actual definitions of the words. It is because of this that there must be a set of definitions wherewich to have a common ground. (i.e. relying on 'common sense' you tend to argue about the definition-content rather than the problem itself.) > as > Georg has explained willingly or not. For example disregarding separation > of interface and implementation is not how things are designed by contrac= t. I actually fail to see exactly where the interface/implementation separation is an issue in Ada 2012. Consider this: The ARM allows a compiler to treat PROCEDURE P( EXTERNAL_PARAM : IN OUT SOME_TYPE ) IS [SUBPROGRAM_TEXT] END P; as the following: PROCEDURE P( EXTERNAL_PARAM : IN OUT SOME_TYPE ) IS INTERNAL_PARAM : SOME_TYPE:=3D EXTERNAL_PARAM; [SUBPROGRAM_TEXT] (renaming EXTERNAL_PARAM to INTERNAL_PARAM) EXTERNAL_PARAM :=3D INTERNAL_PARAM; END P; Now, with the pre- and post-conditions we may expand this PROCEDURE P( EXTERNAL_PARAM : IN OUT SOME_TYPE ) WITH PRE =3D> PRECONDITION, POST =3D> POSTCONDITION IS ... conceptually to: PROCEDURE P( EXTERNAL_PARAM : IN OUT SOME_TYPE ) IS IF NOT PRECONDITION RAISE CONSTRAINT_ERROR; INTERNAL_PARAM : SOME_TYPE:=3D EXTERNAL_PARAM; [SUBPROGRAM_TEXT] (renaming EXTERNAL_PARAM to INTERNAL_PARAM) IF NOT POSTCONDITION RAISE CONSTRAINT_ERROR; EXTERNAL_PARAM :=3D INTERNAL_PARAM; END P; In other words, it seems to me to be the natural progression of Ada 2005's Null Exclusion. Procedure Delete( Param : Not Null Access Link_List_Node ) is begin [Deletion operation] -- Hey, we can get rid of checking for Param =3D Null here! end Delete; By moving the null-exclusion logic "to the parameter" we can get rid of all the cases where, previously, we had to handle Null. Likewise, the pre- and post- conditions allow us to do the same on a more generalized level. Just like, in simple terms, we can disregard worrying about division-by-zero errors in the following code: If Input_2 =3D 0 Then -- If Input_2 is Zero here we have a BIG PROBLEM. Return Input_1 / Input_2; -- Return the division, if it is possible... Else Return Input_1'Base'Last; -- Otherwise, return the maximum value. End If;