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 2002:a24:2b94:: with SMTP id h142mr317655ita.163.1559916611719; Fri, 07 Jun 2019 07:10:11 -0700 (PDT) X-Received: by 2002:a9d:2f0:: with SMTP id 103mr10079823otl.182.1559916611537; Fri, 07 Jun 2019 07:10:11 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.166.216.MISMATCH!g15no222692itd.0!news-out.google.com!l126ni269itl.0!nntp.google.com!s188no228428itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 7 Jun 2019 07:10:11 -0700 (PDT) In-Reply-To: <47d02bdc-6b50-43aa-bc5d-bb5b6225f5bd@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.66.161.135; posting-account=lzqe5AoAAADHhp_gregSufVhvwu22fBS NNTP-Posting-Host: 50.66.161.135 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <455333f0-ede4-4833-900a-240a499395ac@googlegroups.com> Subject: Re: Why .ads as well as .adb? From: Brad Moore Injection-Date: Fri, 07 Jun 2019 14:10:11 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 5656 X-Received-Body-CRC: 1522619583 Xref: reader01.eternal-september.org comp.lang.ada:56537 Date: 2019-06-07T07:10:11-07:00 List-Id: On Friday, June 7, 2019 at 1:59:26 AM UTC-6, Maciej Sobczak wrote: > > Of course, you are essentially saying that separate=20 > > compilation is unnecessary and all of the source for a program should b= e in=20 > > one giant file >=20 > Of course you are proving now that you did not understand the question po= sted earlier in this thread. >=20 > 1. There *are* languages that don't use separate spec files. Java and Pyt= hon are well known examples, representing both compiled and scripted approa= ches. I suspect that may be more to do with language limitations than anything el= se, where the compiler needs to "see" all the code to generate the executable. I think the same could be said of C++ templates, where the template header = file contains all the code, so that the compiler can generate the executabl= e when that source code is inserted into another source file via an #includ= e preprocessor directive. I am not a Java expert, but I note that Java didn't have modules until 2017= in Java 9, but by then Java coding styles were already cemented in through= years of usage. Ada had compiled modules and separate compilation in the f= orm of packages since the beginning. Bolting on features to languages after the fact can be an improvement, but = it helps a lot if the language was well designed from the start. I think it is a big mistake of languages that encourage the specification a= nd implementation to be in the same source file, and very surprised to see = that anyone would be arguing for that. The separation of specification and implementation ties into the "separatio= n of concerns" attributed to Dijkstra way back in 1974. When wanting to make use of a 3rd party package in Ada, I value being able = to generally understand how to use that package by looking at the specifica= tion without having to look at the implementation. You generally only need = to look at the public part of a package specification, as you can rely on a= nything past that as being implementation details. Even with C++, one cannot stop reading when you see a private: keyword in a= class definition, because there can be many public and private sections in= a class. You have to keep reading the class specification until to hit the= end of the class specification, in case you missed more public parts. I think Ada does a better job of getting the programmer to separate specifi= cation from implementation. This can become really valuable when programming in the large. For this rea= son, I think Python is not a good choice for developing a very large system= . I see it as a nice language for writing smaller programs, scripts, and glue= -code, etc. I suspect that when teaching programming languages, small examples are prov= ided that demonstrate language features, and packages in Ada are often not = needed. For example, if one looks at the Ada examples in the Rosetta code w= ebsite,=20 http://www.rosettacode.org=20 You will often see examples that do not use packages. So Ada does seem to p= rovide good capabilities write examples in a single file when that is neede= d. When you work on a large system however, you quickly learn to appreciate th= e separation of specification and implementation however.=20 >=20 > 2. Programs written in those languages do *not* need to be written in one= giant file. Actually, Java is frequently criticized (it was even in this t= hread) for forcing the programmer to use too many (!) files. Even though it= does not have separate specs. Maybe Ada offers a benefit here. In languages like Java, there is a tendenc= y to want to put each class in a separate file. With Ada packages, it can m= ake more sense to organize related types in the same package. Brad