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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.148.138 with SMTP id w132mr32911496iod.138.1514857830125; Mon, 01 Jan 2018 17:50:30 -0800 (PST) X-Received: by 10.157.64.68 with SMTP id o4mr1701531oti.9.1514857829969; Mon, 01 Jan 2018 17:50:29 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!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!border1.nntp.dca1.giganews.com!nntp.giganews.com!i6no4882183itb.0!news-out.google.com!s63ni8331itb.0!nntp.google.com!i6no4882180itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 1 Jan 2018 17:50:29 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:645:c001:2a91:590b:9ec8:8c28:c02a; posting-account=fxr6CwoAAABjARAbZ01okNaxDpxQT8RH NNTP-Posting-Host: 2601:645:c001:2a91:590b:9ec8:8c28:c02a References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <349323e9-8458-4115-b3ec-e619c6d20d3c@googlegroups.com> Subject: Re: Why *.adb and *.ads? From: Mace Ayres Injection-Date: Tue, 02 Jan 2018 01:50:30 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 4143076659 X-Received-Bytes: 3864 Xref: reader02.eternal-september.org comp.lang.ada:49718 Date: 2018-01-01T17:50:29-08:00 List-Id: Andrew, you may think of the *.abs and *.abb as source code in the traditio= n way. The *.ads is the speficition (the =E2=80=98s=E2=80=99 of ads) file, = which specifies the sub programs (functions, procedures) types, and other c= omponents of the (package).=20 The corresponding *.adb is the full body, elaborated, details of the specif= ications (promise of functions, procedures, types, etc.) specified in the *= abs specification.=20 This provides rigorous delivery of the abstraction aspect of Ada. Think of = hiring a very reliable consultant to build x, which will do various things = in a safe and reliable way. The contract you sign promises the WHAT of what= will be delivered, the specifications in the *abs file. The contractor pla= ns, schedules, gather resources and supervises the delivery of the specific= ation. He is the *adb, the actual work that is done. You don=E2=80=99t need to see all the details of how the work is done. In f= act you, or other components of the overall program, don=E2=80=99t want to = know. If the contractor uses Bob instead of Alice to do part of x, you don= =E2=80=99t care as long the the specification of delivery remains consisten= t.=20 =E2=80=94=E2=80=94 Psuedo code,, not clean Ada syntax test.abs ..=20 procedure say_hello (message :string in); procedure dubs. ...; function example .... ; end test; =E2=80=94 speficiation=20 test,adb =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94-= =20 Procedure say_hello is=20 Begin=20 put_line(message);=20 end; =E2=80=94 say_hello function example (,,,, return string)=20 begin return (=E2=80=9CI am not ready yet.=E2=80=9D) end example; end test. =E2=80=94 dbody=20 to use procedue say_hello somewhere, I have=E2=80=9D=20 If happy then=20 say_hello (=E2=80=9Ci am happy=E2=80=9D);=20 else=20 say_hello(=E2=80=9CNot so happy=E2=80=9D);=20 end if;=20 If I code: bucket :=3D example; put (bucket); I see there is a contract for a function called exaple that returns a stri= ng. It=E2=80=99s nothing yet, but I can later elaborate functionality of ex= ample without changing the ingterface. If I change the interface *.ads spec= ification I have to change the body=E2=80=99s ingterface to match in the ad= b file too. The details of the implementation of say_hello may change in the body *.adb= , as long as the procedure definition in the *.abs and *adb domain the same= .=20 t