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 X-Google-Thread: 103376,aea4cc77526f5e4a X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!bolzen.all.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 23 Feb 2008 13:27:18 +0100 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Separate Compilation in Programming Languages References: <47bf11df$0$14990$4f793bc4@news.tdc.fi> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <47c01126$0$23005$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 23 Feb 2008 13:27:18 CET NNTP-Posting-Host: 8803ffea.newsspool1.arcor-online.net X-Trace: DXC=2=bhIe9c@\P[7Non7UCi8Uic==]BZ:af^4Fo<]lROoRQFl8W>\BH3YR][`RHo5^7P_A:ho7QcPOVSMbo2NB<7n1Z2UQ\JS8^GKV X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:20020 Date: 2008-02-23T13:27:18+01:00 List-Id: adaworks@sbcglobal.net wrote: > "Niklas Holsti" wrote in message > news:47bf11df$0$14990$4f793bc4@news.tdc.fi... >> adaworks@sbcglobal.net wrote: >> >>> Do you still use the "is separate" feature in a package body? >> I never use it. My subprograms are rarely long enough to make it useful (given >> that there is no compilation-speed advantage under GNAT), and I seldom use >> nested packages. >> > Thanks. The issue is not compilation speed, nor even size of the > source code. Rather, the real benefit of Ada's separate compilation > model is the management of dependencies. I like separate subprograms or separate package bodies not only because of dependency management, but also because they allow a kind of source code organization not available without separation. It is about distraction and separation of concerns. Given that Ada has nesting, I can make all things local to where they are used. Much like I can do using FPLs' let expressions (as in Scheme or ML) or where clauses (as in Haskell). But I don't have to "clutter the listing" between "is" and "begin" with full implementation details that only disturb linear reading. It's like saying, "I'll leave the details out for the moment", or, "I'll talk about the implementation later". Still the subp profile or package interface have been mentioned. That is, the reader has enough information in order to follow the program text. function sqrt_iter(guess, x: Number) return Number is function improve(guessed: Number) return Number is separate; -- another number approximating sqrt_iter'Result function good_enough(guessed: Number) return Boolean is begin return abs (guessed * guessed - x) < 0.001; end; begin -- sqrt_iter if good_enough(guess) then return guess; else return sqrt_iter(improve(guess), x); end if; end sqrt_iter;