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!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Wed, 5 Jun 2019 13:11:28 +0300 Organization: Tidorum Ltd Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> <87woi0xtwm.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net gknU0leVWcd3wLXmnIEF2gBqCmJxxmzVkV9dRMekvcsvUuSCpk Cancel-Lock: sha1:PoRw5bc9ZPMlb5Hdmz9x0HuZiKg= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <87woi0xtwm.fsf@nightsong.com> Xref: reader01.eternal-september.org comp.lang.ada:56483 Date: 2019-06-05T13:11:28+03:00 List-Id: On 19-06-05 12:28 , Paul Rubin wrote: > "J-P. Rosen" writes: >> Yes, Ada favors readability over writability. > > I find when trying to study a codebase, having the code spread across > too many files seriously impairs readability. That problem is worst > with Java, which puts each class (even small ones) in a separate file. On the other hand, I like it that I can get a first impression of an Ada program by reading just the .ads files. > ML also does have a separate specification languate (the "module > language") and implementation language, I mean really, not like the > crappy .h system of C++. But I think it is ok (i.e. acceptable though > not universal practice in ML) to put both the interface spec and the > implementation in the same file. I don't see what is wrong with the > idea of doing the same thing in Ada. Apart from all the other reasons already given, keeping spec and body in the same file can cause compilation-order problems. Suppose that there are two packages, A and B, such that the specs do not depend on each other but the bodies do. That is, the body of A has "with B" (which really means, "with the spec of B") and the body of B has "with A" (which really means, "with the spec of A"). If the spec and body of A are both in one and the same file, and the spec and body of B are both in another file, when the compiler processes a "with" clause it would have to be able to read, parse and use only the spec part of the "withed" file, while ignoring the body part (because it depends on a spec not yet seen). I admit that this kind of mutual dependence between packages is often frowned on (because it breaks architectural "layering") but I find it hard to completely avoid it. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .