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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: djakoogler Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Fri, 14 Jun 2019 12:29:32 -0400 Organization: A noiseless patient Spider Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> <87woi0xtwm.fsf@nightsong.com> <4a0438de-1f1d-4469-aae4-908854d378ea@googlegroups.com> <47d02bdc-6b50-43aa-bc5d-bb5b6225f5bd@googlegroups.com> <4516d350-0076-4dc7-b482-87d5693d3977@googlegroups.com> <0c9a9692-5fa2-46ba-8649-d5bddcc88a3f@googlegroups.com> Reply-To: djakoogler@_No_Where_Man.Com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 14 Jun 2019 15:29:51 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="405daeb2655c11f58a7a2b1ed55add14"; logging-data="5309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IQzibYJIsE+CLsgQCKQ3QFMiBrK1hq2A=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 Cancel-Lock: sha1:ea8O6W3KPD0ehJx1nSoUftbvNbk= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:56638 Date: 2019-06-14T12:29:32-04:00 List-Id: John, There is one point in this discussion no has raised yet: There may be several different implementations (bodies) for a given specification. In VHDL, a hardware design language which based itself on Ada83 concepts, there is a specification for logic function. The language allows for "architecture behavioral" and "architecture structural" implementations against the specification. The "behavioral" implementation defines the defines the behavior of the function as an algorithm (much as you write the function in Ada), while the "structural" implementation gives a very precise gate-level or netlist description of the function (how you actually do the function with digital components). I believe there may be a third such "architecture" available to describe an analog (transistor) level description. While Ada does not explicitly provide for parallel implementations, you may find many GNAT based projects the use the naming facilities of a GNAT Project File (.gpr) to select different bodies to match certain configurations. For instance, you may want to have one implementation which is a stub and maybe has some tracing statements, and another implementation which has the complete algorithm. Another common variation is one implementation for Unix and another for Windows. By using environment variables when launching gprbuild, the user selects which bodies to use. To be complete, you can use the same naming technique for specs as well as bodies. If you look at it in the right way, you can see where Java and Ada interfaces are to do something similar except interfaces allow the user to make a run-time selection not a build-time selection. For my work with small machines, I almost always need just one implementation at run-time so build-time selection is the way I go. Dave Koogler Engineer