comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Drummond <brian_drummond@btconnect.com>
Subject: Re: Separate Compilation in Programming Languages
Date: Sat, 23 Feb 2008 13:44:25 +0000
Date: 2008-02-23T13:44:25+00:00	[thread overview]
Message-ID: <q760s392l0g6klikofa4gs2ba4jiv1isf0@4ax.com> (raw)
In-Reply-To: FJDvj.10151$0o7.9092@newssvr13.news.prodigy.net

On Fri, 22 Feb 2008 17:35:33 GMT, <adaworks@sbcglobal.net> wrote:

>Recently, I have been engaged in some conversations with colleagues about the 
>value of
>separate compilation.    This is one of my favorite features in Ada.   In fact, 
>as nearly as
>I can tell, none of the other popular languages includes this feature in as 
>well-developed
>a form as Ada.  

One language which does have an equivalent mechanism (perhaps not surprisingly,
given its origin), and in which a similar debate is currently active, is VHDL.

There, the separation takes the form of the "component" specification, within
the consumer of a component. The consumer can instantiate a "component",
(similar to declaring a variable of a type defined separately) whose interface
is guaranteed consistent with its use by the compiler - and at this stage,
nothing is known about the implementation.

Separately, the component is defined as an "entity", and implemented as an
"architecture", which are again guaranteed consistent with each other during
compilation.

It is only at elaboration that an attempt is made to find an "entity" to match
each "component" specification; if there are any failures to match, of course,
elaboration fails with an error.

But there is also a way to bypass separate compilation by direct entity
instantiation, in which an entity specification is embedded in the consumer, in
the place of the component specification. In this case, the matching entity must
be found (already compiled and correct) for the consumer to compile.

Interestingly, in comp.lang.vhdl, the concensus seems to be that direct
instantiation is to be preferred where possible. (google comp.lang.vhdl for
"direct entity instantiation" if you need more of the debate). Two reasons are
usually mentioned: the component specification is just one more piece of code to
write and maintain; (and VHDL is perceived as verbose enough without it), and
forcing the entity/arch to compile concurrently with the consumer is perceived
as catching any errors earlier (i.e. compile time vs elaboration). In other
words, as said here for Java, compilation is cheap.

>This morning, after an especially interesting argument about this feature and, 
>"Why would
>anyone want to do such a thing?" style questions, I decided to approach this 
>forum.  What
>is your view of Ada-style separate compilation when compared to that in other 
>languages?
>Do you find it useful in your own practice?  

I am  out on a limb in still using components, and I'm not entirely clear why I
do, other than mild personal preference, and because the toolset I use
encourages it; it works perfectly well for me. Though I have occasionally had
elaboration failures due to component mis-specification, they haven't caused any
real headaches.

I'm not clear why the theoretical advantages of separate compilation aren't seen
as advantages in practice (in the VHDL world); the outspoken critics are
respected consultants and trainers; possibly they are in one-man or small-team
environments rather than million line projects. 

Possibly separate compilation was a big win when you had 8K of core and a drum
store, but a bit less important nowadays? (coming back to "compilation is cheap"
again)

I'm in a one-man project environment myself, where I can't see a clear win for
either side of the debate; separate compilation certainly doesn't impose
significant drag, except where tool bugs prevent making good use of packages and
libraries. But that's another issue...

- Brian





  parent reply	other threads:[~2008-02-23 13:44 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
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 [this message]
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