comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: Separate Compilation in Programming Languages
Date: Sat, 23 Feb 2008 13:27:18 +0100
Date: 2008-02-23T13:27:18+01:00	[thread overview]
Message-ID: <47c01126$0$23005$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <CzJvj.7422$Ru4.6768@newssvr19.news.prodigy.net>

adaworks@sbcglobal.net wrote:
> "Niklas Holsti" <niklas.holsti@tidorum.invalid> 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;



  parent reply	other threads:[~2008-02-23 12:27 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 17:35 Separate Compilation in Programming Languages adaworks
2008-02-22 17:52 ` Dirk Heinrichs
2008-02-23  0:23   ` adaworks
2008-02-22 18:10 ` Ray Blaak
2008-02-22 23:53   ` adaworks
2008-02-23  1:40     ` Ray Blaak
2008-02-23  7:29       ` adaworks
2008-02-23 18:42         ` Ray Blaak
2008-02-22 18:18 ` Niklas Holsti
2008-02-23  0:14   ` adaworks
2008-02-23  7:23     ` Niklas Holsti
2008-02-23  7:31       ` Niklas Holsti
2008-02-23 16:00         ` adaworks
2008-02-23 12:27     ` Georg Bauhaus [this message]
2008-02-23 12:37   ` Dirk Heinrichs
2008-02-23 13:03     ` Niklas Holsti
2008-02-22 19:11 ` Dmitry A. Kazakov
2008-02-23  0:16   ` adaworks
2008-02-22 19:33 ` Larry Kilgallen
2008-02-22 20:47 ` Simon Wright
2008-02-22 21:27 ` Robert A Duff
2008-02-23  0:12   ` adaworks
2008-02-23 10:28     ` framefritti
2008-02-23 12:45     ` Dirk Heinrichs
2008-02-23 15:16     ` Robert A Duff
2008-02-23 16:47       ` adaworks
2008-02-23 18:47         ` Ray Blaak
2008-02-24  7:40           ` adaworks
2008-02-24  9:42             ` Ray Blaak
2008-02-24 20:41               ` adaworks
2008-02-25  2:37                 ` Ray Blaak
2008-02-25  7:06                   ` adaworks
2008-02-25 13:12                     ` Robert A Duff
2008-02-25 17:44                     ` Ray Blaak
2008-02-25 22:16                       ` Ray Blaak
2008-02-26  5:10                         ` John W. Kennedy
2008-02-26 19:08                           ` Ray Blaak
2008-02-26  7:11                         ` adaworks
2008-02-26 13:38                           ` Stephen Leake
2008-02-26 14:56                             ` adaworks
2008-02-26 19:15                               ` Ray Blaak
2008-02-26 19:13                           ` Ray Blaak
2008-02-26 21:25                             ` Ray Blaak
2008-02-27  1:15                               ` Robert A Duff
2008-02-26  7:06                       ` adaworks
2008-02-26 11:42                       ` Alex R. Mosteo
2008-02-26 15:05                         ` adaworks
2008-02-26 15:15                           ` Alex R. Mosteo
2008-02-24 17:26             ` Robert A Duff
2008-02-23 20:46         ` Robert A Duff
2008-02-24  7:31           ` adaworks
2008-02-24 17:20             ` Robert A Duff
2008-02-24 20:33               ` adaworks
2008-02-25  1:07                 ` Robert A Duff
2008-02-26  7:29                   ` adaworks
2008-02-26 19:22                     ` Ray Blaak
2008-02-27  1:58                       ` adaworks
2008-02-27 20:34                         ` Ray Blaak
2008-02-27 22:31                           ` Robert A Duff
2008-02-27 23:35                             ` Ray Blaak
2008-02-28  0:19                               ` Randy Brukardt
2008-02-28  9:18                               ` Georg Bauhaus
2008-02-29  5:57                             ` adaworks
2008-02-29  6:04                               ` Ray Blaak
2008-02-29 10:48                                 ` Alex R. Mosteo
2008-02-29 17:05                                 ` adaworks
2008-02-29 18:33                                   ` Ray Blaak
2008-02-29  6:10                           ` adaworks
2008-02-22 22:16 ` Jeffrey R. Carter
2008-02-23 13:44 ` Brian Drummond
2008-02-23 17:19   ` adaworks
2008-02-25  7:53 ` Jean-Pierre Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox