comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hymie@prolifics.com>
Subject: Re: Ada
Date: 2000/01/04
Date: 2000-01-04T14:45:25+00:00	[thread overview]
Message-ID: <t77lhpuc8o.fsf@calumny.jyacc.com> (raw)
In-Reply-To: 84rphr$ql5$1@nntp8.atl.mindspring.net

Richard D Riehle <laoXhai@ix.netcom.com> writes:
> 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.

You have not read the literature correctly, or you have not read the
correct literature :-) C++ templates can be (according to the standard,
but not yet in reality) separately compiled, and many errors within the
template can be caught before instantiation. You are correct in that it
is unlikely that a C++ will offer anything but the full-expansion style
of template instantiation.

> 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.

C++ has essentially *no* format for its generic formals, which are
types, templates, or constants. I think that allows C++ to achieve
the same things with its templates that Ada can.

> 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.

Well, C++ doesn't have range constraints and subtypes (which is
too bad), so it can hardly overload on them. But it does have
enumerations, and those are fully overloadable. But C++ doesn't
have attributes, so one can't write a generic wrap-around successor
function, for example, so there, I've found an example for you :-)

> 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.

I hold that a C++ class is more-or-less equivalent to an Ada package,
so a generic formal package in Ada would simply correspond to a generic
formal class in C++.




  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         ` Ada Robert Dewar
2000-01-04  0:00           ` Ada Robert A Duff
2000-01-04  0:00             ` Ada Hyman Rosen
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 Richard D Riehle
2000-01-04  0:00           ` Hyman Rosen [this message]
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             ` Ted Dennison
2000-01-06  0:00               ` Charles Hixson
2000-01-06  0:00               ` Samuel T. Harris
2000-01-07  0:00                 ` Robert Dewar
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-07  0:00                   ` Ted Dennison
2000-01-07  0:00                     ` Brian Rogoff
2000-01-05  0:00             ` Pat Rogers
2000-01-05  0:00               ` Charles Hixson
2000-01-05  0:00             ` Matthew Heaney
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 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 Jon Jensen
1999-12-23  0:00 ` Ada Robert Dewar
1999-12-23  0:00   ` Ada tmoran
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 Ted Dennison
2000-01-03  0:00             ` Ada Robert Dewar
2000-01-03  0:00               ` Ada Marin D. Condic
2000-01-03  0:00                 ` Ada Larry Kilgallen
2000-01-04  0:00                   ` Ada Charles Hixson
2000-01-03  0:00                 ` Ada Roger Racine
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
2000-01-13  0:00     ` Ada Magnus Alexandersson
1999-12-23  0:00 ` Ada Greg Martin
  -- 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