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 X-Received: by 2002:a24:d205:: with SMTP id z5-v6mr1251202itf.35.1530724889922; Wed, 04 Jul 2018 10:21:29 -0700 (PDT) X-Received: by 2002:aca:2b06:: with SMTP id i6-v6mr553694oik.0.1530724889711; Wed, 04 Jul 2018 10:21:29 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!d7-v6no1871460itj.0!news-out.google.com!l67-v6ni1826itl.0!nntp.google.com!d7-v6no1871459itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 4 Jul 2018 10:21:29 -0700 (PDT) In-Reply-To: <590d4672-4aef-42a5-823c-57ccd291115a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.195.62; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.195.62 References: <856189aa-fa00-4960-929e-174f352310ad@googlegroups.com> <2718c8d4-5f35-4fd8-a1aa-1e60069a7a5d@googlegroups.com> <39fce60c-9f56-42fb-b679-fa08810b00ee@googlegroups.com> <3701bf07-89a5-4cb0-a704-5aebb589ca79@googlegroups.com> <2f5e4ce0-94e8-4b94-9da7-045ec90a9b22@googlegroups.com> <18554067-1382-4b43-a832-2d27aa5117d7@googlegroups.com> <8dc19505-b68a-403c-a164-f1de1864f3f1@googlegroups.com> <559657f8-bbf4-4a70-9449-f85bc98d6c6b@googlegroups.com> <590d4672-4aef-42a5-823c-57ccd291115a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Teaching C/C++ from Ada perspective? From: "Dan'l Miller" Injection-Date: Wed, 04 Jul 2018 17:21:29 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 6517 X-Received-Body-CRC: 3204493055 Xref: reader02.eternal-september.org comp.lang.ada:53603 Date: 2018-07-04T10:21:29-07:00 List-Id: On Wednesday, July 4, 2018 at 9:56:46 AM UTC-5, Maciej Sobczak wrote: > > > Yet, the trivial update of P (like adding whitespace, which again has > > > no semantic meaning whatsoever) forces the recompilation of Test (wit= h > > > GNAT). Actually, it forces the recompilation of everything. Why? > >=20 > > gprbuild: > > -m Minimum Ada recompilation > >=20 > > Only rebuild if there's a semantic difference >=20 > Great! Let's try it out. > I have added a dummy declaration to P, like here: >=20 > -- p.ads: > package P is > pragma Pure (P); > type TI is new Integer; -- new dummy definition > end P; >=20 > and... the whole project was recompiled from scratch. >=20 > No other part of the project relies on this new type and in particular, t= he author of Test still could not care less about package P and whatever it= contains. > Yet, the author of Test had to wait for the whole project to recompile, b= ecause something irrelevant was added to some irrelevant package that he mi= ght not even know that exists in the project. >=20 > I presume that the -m switch was supposed to handle a trivial (and perhap= s frequent) case of editing comments and whitespace. There is some added va= lue in this, but it is easy to replicate for C++ and sorry, but I don't cal= l it "semantic" if it cannot figure out even the most basic cases like the = one above. >=20 > My claim that Ada and C++ compilers have the same challenges when it come= s to handling the physical project structure holds. Maciej, btw, which precise version of GNAT are you utilizing? GNAT in 2018 (or whichever recent year is your release) is defective compar= ed to the Rational R1000 in the late 1980s. =20 http://www.dtic.mil/dtic/tr/fulltext/u2/a198934.pdf =C2=A72.1.2.1. Basis for Effective Smart Processing, page 12: =E2=80=9CThe Rational Environment is able to provide smart processing becau= se it maintains Ada programs as logical units, storing them in the Diana re= presentation. This permits the Rational Environment to track user modificat= ions to the program at the granularity of program units and =E2=80=A2smalle= r units=E2=80=A2 (i.e., =E2=80=A2=E2=80=A2=E2=80=A2individual declarations = and statements=E2=80=A2=E2=80=A2=E2=80=A2). The Diana representation not on= ly reflects the abstract syntax of Ada programs (from which textual represe= ntations can be regenerated), but also contains semantic information. Seman= tic information includes type information and depend- ency information. Dep= endency information not only reflects export/import dependencies due to Ada= with clauses, but actual usage sites (e.g., all procedure call sites). The= se actual usage sites are maintained within program units as well as across= program units at the level of individual declarations. =E2=80=9C=C2=B6 On one hand, the Rational Environment makes this semantic i= nformation available to the user through queries. On the other hand, the Ra= tional Environment takes advantage of this infor- mation to perform "smart = reprocessing," i.e., keeping the reprocessing due to a change at a minimum.= It maintains semantic information in the Diana representation consistently= by demoting dependent program units when a declaring unit is demoted to al= low modification. Note that demotion to source state results in removing th= e demoted unit from semantic information in the Diana representation, i.e.,= units in source state will not be found when queries are run on seman- tic= information such as finding usage sites. =E2=80=9C=C2=B6 Conventional Ada environments require reprocessing of depen= dent program units any time any change is made to a program unit specification. The Rational Environment ta= kes advantage of the Diana structure to permit certain modifications without invalidating de= pendent program units. These include modification of comments, =E2=80=A2=E2=80=A2addition of decla= ration to package specifications=E2=80=A2=E2=80=A2, etc. (see Section 2.1.1.2). As a result, fewer recompilations are required than = in conventional Ada environments.=E2=80=9D I see your sloppy GNAT and raise you one well-disciplined(-by-William-Wulf)= Rational R1000. Maciej, please provide any C++ compilation system from an= y point in human history which a normative reference claims to have this re= build-avoidance feature at the level of =E2=80=9Cindividual declarations an= d statements=E2=80=9D.