comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: should I be interested in ada?
Date: 1999/02/19
Date: 1999-02-19T00:00:00+00:00	[thread overview]
Message-ID: <7akvao$j5t$2@plug.news.pipex.net> (raw)
In-Reply-To: 36CD8DBA.237C@lanl.gov

William Clodius wrote in message <36CD8DBA.237C@lanl.gov>...
|Perhaps the best simple example is the FORALL statement to do a
|reordering of elements
|
|FORALL (I=1:N) X(J(I)) = X(I)
|
|which in Ada would require the explicit creation of a temporary to hold
|the value of X, assignment to the temporary, and then the assignment of
|the temporary to X. Note it is required that the values of J(1:N) not
|duplicate one another and lie within the dimensioned ranges of X.


This is a simple example, granted. But, it can be done without undue
difficulty in Ada by declaring an appropriate procedure:

   procedure Reorder (Object: in out Vector; Index: in Selection) is
      Temp: constant Vector := Object;
   begin
      for i in Index'Range loop
         Object(Index(i)) := Temp(i);
      end loop;
   end;

and perhaps adding:

   pragma Inline(Reorder);

and then making the call:

   Reorder(X,J);

You've got to declare a utility procedure, certainly, but otherwise this is
just as neat as the Fortran, surely? More so, perhaps? And it will not
necessarily produce object code which is any less efficient than the Fortran
equivalent.

The basic principle is that there is no Fortran 90 construct which cannot be
modelled, perfectly adequately, by an Ada abstraction (typically a procedure
or function). Furthermore, you get something extra in making that
abstraction: encapsulation (factoring out common code), and a degree of
self-documentation (the name of the subprogram says what it does).

-------------------------------------
Nick Roberts
-------------------------------------







  reply	other threads:[~1999-02-19  0:00 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-14  0:00 should I be interested in ada? Phillip Helbig
1999-02-15  0:00 ` Marin David Condic
1999-02-23  0:00   ` David Starner
1999-02-15  0:00 ` Gautier
1999-02-16  0:00 ` Ken Thomas
1999-02-17  0:00   ` Nick Roberts
1999-02-18  0:00     ` robert_dewar
1999-02-18  0:00       ` Nick Roberts
1999-02-18  0:00         ` Jerry Petrey
1999-02-18  0:00           ` fraser
1999-02-19  0:00             ` Matthew Heaney
1999-02-20  0:00               ` fraser
1999-02-18  0:00           ` Nick Roberts
1999-02-18  0:00             ` Joel Seidman
1999-02-18  0:00             ` Dan Nagle
1999-02-18  0:00               ` nabbasi
1999-02-19  0:00               ` Nick Roberts
1999-02-19  0:00                 ` robert_dewar
1999-02-19  0:00                   ` Nick Roberts
1999-02-19  0:00                     ` William Clodius
1999-02-20  0:00                       ` Nick Roberts
1999-02-21  0:00                         ` robert_dewar
1999-02-21  0:00                           ` William Clodius
1999-02-22  0:00                           ` Nick Roberts
1999-02-19  0:00                     ` robert_dewar
1999-02-21  0:00                       ` William Clodius
1999-02-23  0:00                         ` Robert I. Eachus
1999-02-19  0:00                 ` Dan Nagle
1999-02-19  0:00                   ` robert_dewar
1999-02-19  0:00                     ` Dan Nagle
1999-02-19  0:00                     ` Nick Roberts
1999-02-23  0:00                     ` Peter Hermann
1999-02-18  0:00         ` William Clodius
1999-02-18  0:00           ` nabbasi
1999-02-18  0:00             ` robert_dewar
1999-02-18  0:00           ` robert_dewar
1999-02-19  0:00             ` William Clodius
1999-02-19  0:00               ` Nick Roberts [this message]
1999-02-20  0:00                 ` robert_dewar
1999-02-22  0:00                   ` Nick Roberts
1999-02-22  0:00                     ` William Clodius
1999-02-23  0:00                     ` robert_dewar
1999-02-23  0:00                       ` Nick Roberts
1999-02-22  0:00                 ` William Clodius
1999-02-23  0:00                   ` Nick Roberts
1999-02-23  0:00                     ` William Clodius
1999-02-25  0:00                       ` Nick Roberts
1999-02-25  0:00                         ` robert_dewar
1999-02-23  0:00               ` Robert I. Eachus
1999-02-24  0:00                 ` William Clodius
1999-02-24  0:00                 ` Nick Roberts
1999-02-26  0:00                   ` Robert A Duff
1999-02-27  0:00                     ` Semantic info pragmas (was: should I be interested in ada?) Nick Roberts
1999-03-01  0:00                       ` Samuel Tardieu
1999-03-01  0:00                         ` Robert A Duff
1999-02-24  0:00               ` should I be interested in ada? William Clodius
1999-02-25  0:00                 ` Nick Roberts
1999-02-25  0:00                   ` robert_dewar
1999-02-26  0:00                     ` Nick Roberts
1999-02-18  0:00         ` robert_dewar
1999-02-19  0:00           ` Nick Roberts
1999-02-19  0:00             ` robert_dewar
1999-02-19  0:00               ` dennison
1999-02-19  0:00                 ` robert_dewar
1999-02-19  0:00                 ` William Clodius
1999-02-19  0:00                 ` Nick Roberts
1999-02-20  0:00                   ` robert_dewar
1999-02-22  0:00                     ` Nick Roberts
1999-02-19  0:00               ` Phillip Helbig
1999-02-19  0:00               ` Nick Roberts
1999-02-20  0:00                 ` robert_dewar
1999-02-20  0:00                   ` Steve Doiel
1999-02-20  0:00                 ` robert_dewar
1999-02-22  0:00                   ` dennison
1999-02-22  0:00                   ` Nick Roberts
1999-02-23  0:00                     ` Robert I. Eachus
1999-02-24  0:00                       ` White rabbit (was: should I be interested in ada?) dennison
1999-02-25  0:00                       ` Alice books " JP Thornley
1999-02-25  0:00                         ` Robert I. Eachus
1999-02-19  0:00               ` should I be interested in ada? William Clodius
1999-02-18  0:00     ` robert_dewar
1999-02-18  0:00       ` Nick Roberts
1999-02-18  0:00         ` William Clodius
1999-02-18  0:00           ` dennison
1999-02-20  0:00 ` Hartmut H. Schaefer
1999-02-20  0:00   ` bill
1999-02-21  0:00     ` dewar
1999-02-21  0:00   ` dewar
1999-02-22  0:00     ` dennison
replies disabled

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