comp.lang.ada
 help / color / mirror / Atom feed
From: Richard D Riehle <laoXhai@ix.netcom.com>
Subject: Re: Ada
Date: 2000/01/04
Date: 2000-01-04T03:31:07+00:00	[thread overview]
Message-ID: <84rphr$ql5$1@nntp8.atl.mindspring.net> (raw)
In-Reply-To: t7aemmtz3b.fsf@calumny.jyacc.com

In article <t7aemmtz3b.fsf@calumny.jyacc.com>,
	Hyman Rosen <hymie@prolifics.com> wrote:

>C++ provides excellent implementation of generics,
>and good implementation of overloading, except that
>one cannot overload on return type as in Ada.
>
>Is there something specific you believe you can not
>do in C++ with regard to these abilities?

There are some differences in Ada and C++. The issue is not
"can not do" but rather how it is done and whether the Ada
way is any improvement.   Also, it is never a matter of
whether something can or cannot be done in a particular 
language.  Rather, the issue is whether a given language
is more expressive of a desired capability.  In many ways,
Ada is more expressive.  In other ways, C++ is more expressive.

Ada generics (templates)are always compiled before they are 
"included" by the client.  This is a function of the Ada library
model.  The instantiation is permitted only after the successful
compilation of the generic unit.  This puts type checking a little
closer to the origination of the generic.  

If I read the C++ literature correctly, C++ templates are expected
to be "full expansion" units.  Ada permits a template to be instantiated
in other forms to conserve memory. Some compilers support this.

Ada has more formats for generic formal parameters.  This has its
advantages and may sometimes have disadvantages.  The designer needs
to learn more idioms of the language.  Once having learned those idioms,
more options for template design are available.

Ada permits but does not require as much overloading of operators
as one needs in a C++.  This is useful when one is creating templates
for simple scalar and numeric types.  It does simplify the templates
for those types.  Actually, in this case, the Ada model is somewhat
an improvement over C++.  Of course, a C++ advocate may answer that
the word "class" may be used for a built-in type, but this still falls
short of the Ada model for range constraints and other rules of
scalar types.

Ada is more complicated when creating templates in which an entire
package is a generic formal parameter.  C++ is very straightfoward
in this regard.  The consequence is that this powerful feature of
Ada is often ignored by component designers.  In time, as Ada 
practitioners become more comfortable with its capabilities, we should
see more use of it.  Meanwhile, C++ seems much easier when one needs
one of more classes as generic formal parameters.

On the other hand, a generic formal package parameter provides the
equivalent of a namespace parameter, something I suspect cannot be
expressed easily in C++.  It also enables one to design reusable 
signatures for simplifying the parameter lists of application frameworks
components. Moreover, these signatures are subjected to all the 
checks of the compiler before they may ever be used.

Implementation of Ada generics can take advantage of child
library units, including private child library units to create,
as private child package specifications, a whole subsystem of reusable
package bodies.  This is not widely used, in practice, but has 
substantial power once it is understood by Ada component designers.

There are lots of other issues where Ada is more expressive of 
the component design problem.  I am sure others who frequent this
forum will note some of the more obvious ones I have overlooked.

Richard Riehle




  reply	other threads:[~2000-01-04  0:00 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-23  0:00 Ada Brijesh
1999-12-23  0:00 ` Ada reason67
1999-12-23  0:00   ` Ada Robert Dewar
2000-01-03  0:00     ` Ada Terry Sikes
2000-01-03  0:00       ` Ada Hyman Rosen
2000-01-04  0:00         ` Richard D Riehle [this message]
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00             ` Ada Robert A Duff
2000-01-04  0:00             ` Ada Richard D Riehle
2000-01-04  0:00         ` Ada Terry Sikes
2000-01-05  0:00           ` Operators -> unit analysis Charles Hixson
2000-01-05  0:00             ` Hyman Rosen
2000-01-05  0:00               ` Matthew Heaney
2000-01-05  0:00             ` Matthew Heaney
2000-01-05  0:00               ` Charles Hixson
2000-01-05  0:00             ` Ted Dennison
2000-01-06  0:00               ` Samuel T. Harris
2000-01-07  0:00                 ` Robert Dewar
2000-01-07  0:00                   ` Ted Dennison
2000-01-07  0:00                     ` Brian Rogoff
2000-01-07  0:00                   ` Robert A Duff
2000-01-07  0:00                     ` Matthew Heaney
2000-01-08  0:00                       ` Robert Dewar
2000-01-08  0:00                         ` Robert A Duff
2000-01-10  0:00                       ` Operator precedence--was " Howard W. LUDWIG
2000-01-14  0:00                         ` Mark A Biggar
2000-01-06  0:00               ` Charles Hixson
2000-01-05  0:00             ` Pat Rogers
2000-01-05  0:00               ` Charles Hixson
2000-01-06  0:00             ` Robert Dewar
2000-01-06  0:00               ` Terry Sikes
2000-01-06  0:00                 ` Robert A Duff
2000-01-07  0:00                   ` Terry Sikes
2000-01-07  0:00                     ` Brian Rogoff
2000-01-07  0:00                 ` Ted Dennison
2000-01-07  0:00                   ` Tucker Taft
2000-01-08  0:00                     ` Robert Dewar
2000-01-10  0:00                       ` Tucker Taft
2000-01-10  0:00                         ` Florian Weimer
2000-01-04  0:00         ` Ada Robert Dewar
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00           ` Ada Robert A Duff
2000-01-04  0:00             ` Ada Hyman Rosen
2000-01-04  0:00         ` Ada Florian Weimer
2000-01-04  0:00           ` Ada Brian Rogoff
2000-01-04  0:00           ` Ada Hyman Rosen
2000-01-04  0:00       ` Ada Robert Dewar
2000-01-04  0:00         ` Ada Terry Sikes
2000-01-05  0:00           ` Ada Robert Dewar
2000-01-05  0:00             ` Ada Terry Sikes
2000-01-06  0:00           ` Ada Al Christians
2000-01-06  0:00             ` Ada Terry Sikes
2000-01-07  0:00             ` Ada Robert Dewar
1999-12-23  0:00 ` Ada Greg Martin
1999-12-23  0:00 ` Ada Jon Jensen
1999-12-23  0:00 ` Ada Roger Racine
1999-12-28  0:00   ` Ada Marin D. Condic
1999-12-31  0:00     ` Ada Richard D Riehle
2000-01-02  0:00       ` Ada Marin D. Condic
2000-01-02  0:00         ` Ada Robert Dewar
2000-01-02  0:00           ` Ada Marin D. Condic
2000-01-03  0:00             ` Ada Robert Dewar
2000-01-03  0:00               ` Ada Marin D. Condic
2000-01-03  0:00                 ` Ada Roger Racine
2000-01-03  0:00                 ` Ada Larry Kilgallen
2000-01-04  0:00                   ` Ada Charles Hixson
2000-01-03  0:00             ` Ada Ted Dennison
2000-01-13  0:00     ` Ada Magnus Alexandersson
2000-01-13  0:00     ` Ada Magnus Alexandersson
2000-01-14  0:00       ` Ada Tarjei T. Jensen
2000-01-14  0:00         ` Ada Larry Kilgallen
2000-01-14  0:00           ` Ada Marin D. Condic
2000-01-14  0:00             ` Ada Magnus Alexandersson
2000-01-14  0:00               ` Ada Marin D. Condic
1999-12-23  0:00 ` Ada Robert Dewar
1999-12-23  0:00   ` Ada tmoran
  -- strict thread matches above, loose matches on Subject: below --
2005-01-26 20:06 Ada mcf501
2005-01-26 20:24 ` Ada Larry Kilgallen
2005-01-26 23:55   ` Ada Stephen Leake
2005-01-26 20:35 ` Ada Frank J. Lhota
2005-01-26 23:57   ` Ada Stephen Leake
2005-01-26 20:57 ` Ada Ludovic Brenta
2005-01-26 23:54 ` Ada Stephen Leake
2005-01-27  0:42 ` Ada Jeffrey Carter
2005-01-27  1:17   ` Ada Larry Kilgallen
2005-01-27  4:43     ` Ada u_int32_t
2005-01-27  8:10       ` Ada Larry Kilgallen
2005-01-27 21:01       ` Ada Björn Lundin
2005-01-27  7:57 ` Ada Frank Piron
2005-01-27 10:53   ` Ada Larry Kilgallen
2005-01-27 11:05     ` Ada Frank Piron
2005-01-27 11:19     ` Ada Adrien Plisson
2005-01-28 10:27     ` Ada Stephen Leake
2005-01-27  9:12 ` Ada Martin Krischik
     [not found] <MPG.12c98531dcc142319896ce@news.uci.kun.nl>
     [not found] ` <83reu2$2soi$1@msunews.cl.msu.edu>
     [not found]   ` <38615cc4.22862595@news.shuswap.net>
     [not found]     ` <84dnsu$g69@nnrp1.farm.idt.net>
     [not found]       ` <84drm7$ss8$1@news.rchland.ibm.com>
     [not found]         ` <855lqp$t2@nnrp4.farm.idt.net>
     [not found]           ` <ey3vh54ybxh.fsf@cley.com>
     [not found]             ` <85l4kt$e9q@nnrp1.farm.idt.net>
     [not found]               ` <y4wvpdknsm.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
2000-01-14  0:00                 ` Ada Andy Glew
2000-01-14  0:00                   ` Ada Chris Morgan
2000-01-14  0:00                   ` Ada Marin D. Condic
2000-01-15  0:00                     ` Ada Andy Glew
2000-01-15  0:00                       ` Ada Marin D. Condic
2000-01-15  0:00                       ` Ada Chris Morgan
1997-10-28  0:00 Ada N6101233
1997-08-23  0:00 Ada Jeffrey D. Iverson
1996-08-05  0:00 ada BCummi6553
1996-06-14  0:00 ADA Robert Adams
1990-03-12  2:14 A Poor Man's Ada Library Ted Holden
1990-03-12  5:08 ` Ada William Thomas Wolfe, 2847 
1990-03-15 20:32   ` Ada William B. Tyler
1990-03-16 14:08     ` Ada Dennis M. O'Connor
1990-03-08 18:46 ADA jj
1989-11-19  3:33 A farewell to Ada Ted Holden
1989-11-19 17:59 ` Ada William Thomas Wolfe, 2847 
1989-11-14 21:24 A farewell to Ada Ted Holden
1989-11-15 16:06 ` Ada William Thomas Wolfe, 2847 
1989-11-16 19:08   ` Ada Walter Rowe
1989-11-16 21:33     ` Ada William Thomas Wolfe, 2847 
1989-11-17 18:53       ` Ada Pablo Fernicola
1989-11-18 18:55         ` Ada William Thomas Wolfe, 2847 
1989-11-21  5:24           ` Ada Andrew Koenig
1989-11-22  9:54             ` Ada Mats Luthman
1989-11-22 18:44             ` Ada William Thomas Wolfe, 2847 
1989-11-23  9:44               ` Ada Mats Luthman
1989-11-23  7:12             ` Ada Markku Sakkinen
1989-11-18  6:38       ` Ada Marco S Hyman
replies disabled

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