comp.lang.ada
 help / color / mirror / Atom feed
From: arny@cbnewsl.ATT.COM (arny.b.engelson)
Subject: Re: 9X and the NEED for preprocessing
Date: 19 Dec 89 22:12:06 GMT	[thread overview]
Message-ID: <3379@cbnewsl.ATT.COM> (raw)
In-Reply-To: 20600027@inmet

In article <20600027@inmet> stt@inmet.inmet.com writes:
>
>With regard to Ada preprocessors, and Ada9X:
>
>However, I am not a great fan of Ada preprocessors.
>We have implemented a compiler system and development tools
>for 6 targets and 7 hosts without using a preprocessor.

I doubt there is a situation that REQUIRES the use of a preprocessor, but
that doesn't mean we shouldn't have one.  We don't really NEED a "for loop"
in Ada, nor recursion, nor many other features that one programmer chooses
to use while another does not.  That doesn't mean we shouldn't have them.

>Our general strategy is to define one or more target/host-independent
>package specs with target/host-dependent bodies.
>We minimize the size of such packages, and simply reimplement
>them for each distinct target/host.
>Sometimes, the package spec is target/host-dependent as well,
>but only in its definitions, not in the names defined (e.g.,
>one host might define the type "Link_Name" as being an 8 character string,
>another might define it as being a 30 character string).

This is my preferred strategy as well, and I believe it is the "better"
method (since it stays within the language), but not all programmers agree.

Differences in package specs generally require a lot more compilation
to go from one target to another.  I think it also tends to be harder to
split the constant code from the code that varies by target when you are
dealing with package specs.  There tend to be a lot of dependencies.

>The net effect of this approach is that a particular configuration
>is determined by a set of source files, not a set of preprocessor
>switches.  Also, for cases where we do restrict differences to bodies,
>we can select a different configuration at link time by choosing
>a distinct "implementation catalog variant" (in Intermetrics AIE-speak),
>requiring no recompilation.

This doesn't work when your targets use compilers from different companies.
Sometimes you have no choice in picking your compiler(s) or your targets.
Also, what do you do when you have different variations of a package body,
and must change a piece of code that is common to all of them (but was too
difficult to split out)? You end up making the same changes in each version
of the package body.

>Anyway, so much for truth and beauty.  If there is a compelling
>argument for a standardized preprocessor, I am sure that the Ada9X
>process will be willing to consider it, even though the "official"
>public revision request period is over.  The Ada9X process is
>going to include a number of public reviews, and the various
>project teams working on Ada9X will continue to keep their
>ears open for brilliant and/or urgent proposals.
>
>S. Tucker Taft  (Ada9X DR -- aka "distinguished" reviewer)
>Intermetrics, Inc.
>Cambridge, MA  02138

As to what would constitute a compelling argument, I don't know.  But, I
can say that there are times a preprocessor is a handy thing.  We have a
case with multiple targets and multiple compilers (sorry, I can't be very
specific), resulting in (some parts of the code) up to 10 different versions
of a package.  This includes some targets with functionality left out, other
functionality added, different record (bit) layout, etc.  Some vary in the
definitions.  We also have different customers with slightly different
requirements and using different subsets of target processors.

Imagine maintaining 10 different versions of a file and ensuring that they
are all functionally equivalent (in their common areas).  Some of this is
reduced by proper separating of the common code from the code that changes,
but in some cases this is not possible.  A preprocessor can ease
maintainence and testing, and provides a convenient way to add/remove
performance monitoring and debugging code.  It's not for me, but it may be
for others, and therefore we will all benefit from it being standardized.

As for the Ada9X process, I don't think it necessary that a standardized
preprocessor effort be tied to Ada9X.  A preprocessor is not part of the
language, it is a support tool.  It can easily be a separate effort
(such as CAIS, Ada/POSIX, Ada/SQL, etc.).  Besides, I think it is a more
difficult task than it may first seem.  What I think can end up being a
problem is contractual legalities (the code is not pure Ada).  Of course,
we could MAKE a preprocessor part of the language, forcing all compilers
to support it, adding ACVC tests for it, etc.

  -- Arny Engelson   att!wayback!arny

  parent reply	other threads:[~1989-12-19 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <629648260@<1825>
1989-12-18 19:09 ` 9X and the NEED for preprocessing stt
1989-12-19 21:29   ` preprocessing & optimization William Thomas Wolfe, 2847 
1989-12-21 20:58     ` stt
1989-12-22 20:39       ` Tucker's new proposal William Thomas Wolfe, 2847 
1989-12-30  5:22         ` Metafont Consultant Account
1989-12-19 22:12   ` arny.b.engelson [this message]
1989-12-22  4:40 9X and the NEED for preprocessing Michael Hunter
  -- strict thread matches above, loose matches on Subject: below --
1989-12-14 14:17 Bob Munck
replies disabled

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