From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Wanted: Ada STL. Reward: Ada's Future
Date: 1999/02/06
Date: 1999-02-06T00:00:00+00:00 [thread overview]
Message-ID: <m3iudgyv0k.fsf@mheaney.ni.net> (raw)
In-Reply-To: Pine.BSF.4.05.9902050906310.3807-100000@shell5.ba.best.com
Brian Rogoff <bpr@shell5.ba.best.com> writes:
> Another strength of C++ is in automatic instantiation of generic
> subprograms. This reduces the number of instantiations, and makes code a
> lot more readable, IMO, in the same way that overloading properly used
> makes code more readable.
You can get some of this in Ada, by using default params for generic
formal subprograms:
generic
type Item_Type is private;
type Stack_Type is limited private;
with procedure Push
(Item : in Item_Type;
On : in out Stack_Type) is <>;
package GP is ...;
If Push is directly visible at the point of instantiation, then you
don't need to specify explicitly:
package Item_Stacks is new Stacks (Item_Type);
use Item_Stacks;
package P is new GP (Item_Type, Stack_Type);
Another, lesser-used technique is to provide default parameters by name:
generic
...
package GP is
...
procedure Do_Nothing;
generic
with procedure Do_At_End_Of_Line is Do_Nothing;
package GQ is
...
end GQ;
end GP;
A client that doesn't need to do an end-of-line processing, doesn't need
to say anything else in his instantiation:
package Q is new P.GQ;
Of course, he may want to do something different from the default:
procedure Write_EOL;
package Q is new P.GQ (Write_EOL);
next prev parent reply other threads:[~1999-02-06 0:00 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-31 0:00 Wanted: Ada STL. Reward: Ada's Future Alexy V Khrabrov
1999-01-31 0:00 ` Simon Wright
1999-02-01 0:00 ` Jerry van Dijk
1999-02-01 0:00 ` Marin David Condic
1999-02-01 0:00 ` dennison
1999-02-01 0:00 ` Stanley R. Allen
1999-02-01 0:00 ` Brian Rogoff
1999-02-01 0:00 ` Ehud Lamm
1999-02-02 0:00 ` Pointer Arithmetic (was: Wanted: Ada STL....) adam
1999-02-02 0:00 ` William Clodius
1999-02-03 0:00 ` adam
1999-02-03 0:00 ` robert_dewar
1999-02-03 0:00 ` Jean-Pierre Rosen
1999-02-03 0:00 ` Nick Roberts
1999-02-03 0:00 ` William Clodius
1999-02-03 0:00 ` robert_dewar
1999-02-03 0:00 ` Nick Roberts
1999-02-03 0:00 ` robert_dewar
1999-02-03 0:00 ` Robert A Duff
1999-02-02 0:00 ` Wanted: Ada STL. Reward: Ada's Future Brian Rogoff
1999-02-02 0:00 ` robert_dewar
1999-02-04 0:00 ` Ehud Lamm
1999-02-03 0:00 ` John English
1999-02-03 0:00 ` Matthew Heaney
1999-02-03 0:00 ` Brian Rogoff
1999-02-04 0:00 ` Stephen Leake
1999-02-04 0:00 ` Brian Rogoff
1999-02-05 0:00 ` Stephen Leake
1999-02-05 0:00 ` Brian Rogoff
1999-02-04 0:00 ` Matthew Heaney
1999-02-04 0:00 ` Hyman Rosen
1999-02-05 0:00 ` Stephen Leake
1999-02-05 0:00 ` Hyman Rosen
1999-02-05 0:00 ` John English
1999-02-05 0:00 ` Tucker Taft
1999-02-05 0:00 ` Richard D Riehle
1999-02-05 0:00 ` Brian Rogoff
1999-02-05 0:00 ` Brian Rogoff
1999-02-06 0:00 ` Matthew Heaney [this message]
1999-02-05 0:00 ` Nick Roberts
1999-02-05 0:00 ` John English
1999-02-04 0:00 ` Ehud Lamm
1999-02-04 0:00 ` Brian Rogoff
1999-02-05 0:00 ` Matthew Heaney
1999-02-05 0:00 ` Brian Rogoff
1999-02-08 0:00 ` John English
1999-02-04 0:00 ` Al Christians
1999-02-04 0:00 ` Pat Rogers
1999-02-04 0:00 ` Larry Kilgallen
1999-02-04 0:00 ` Pat Rogers
1999-02-04 0:00 ` Larry Kilgallen
1999-02-05 0:00 ` robert_dewar
1999-02-05 0:00 ` Tom Moran
1999-02-05 0:00 ` dewar
1999-02-05 0:00 ` Tom Moran
1999-02-05 0:00 ` dewar
1999-02-05 0:00 ` dennison
1999-02-06 0:00 ` dewar
1999-02-08 0:00 ` dennison
1999-02-08 0:00 ` robert_dewar
1999-02-08 0:00 ` dennison
1999-02-09 0:00 ` robert_dewar
1999-02-09 0:00 ` dennison
1999-02-09 0:00 ` Nick Roberts
1999-02-07 0:00 ` Simon Wright
1999-02-08 0:00 ` Corey Minyard
1999-02-08 0:00 ` Open Source Licensing (was: Wanted: Ada STL. Reward: Ada's Future) dennison
1999-02-08 0:00 ` Corey Minyard
1999-02-09 0:00 ` robert_dewar
1999-02-09 0:00 ` Corey Minyard
1999-02-09 0:00 ` dennison
1999-02-09 0:00 ` Corey Minyard
1999-02-09 0:00 ` Wanted: Ada STL. Reward: Ada's Future robert_dewar
1999-02-09 0:00 ` dennison
1999-02-10 0:00 ` robert_dewar
1999-02-07 0:00 ` Simon Wright
1999-02-05 0:00 ` Larry Kilgallen
[not found] ` <36ba730b.35540068@ <79fmg1$fn0$1@nnrp1.dejanews.com>
1999-02-06 0:00 ` Larry Kilgallen
1999-02-05 0:00 ` robert_dewar
1999-02-05 0:00 ` robert_dewar
1999-02-05 0:00 ` Larry Kilgallen
1999-02-05 0:00 ` robert_dewar
[not found] ` <79f24e$t14 <36BB4162.52FC6D9F@averstar.com>
1999-02-05 0:00 ` robert_dewar
1999-02-05 0:00 ` dennison
1999-02-05 0:00 ` dennison
1999-02-05 0:00 ` robert_dewar
1999-02-05 0:00 ` dennison
1999-02-06 0:00 ` Nick Roberts
1999-02-05 0:00 ` Tucker Taft
1999-02-05 0:00 ` John English
1999-02-09 0:00 ` micro_ada
1999-02-05 0:00 ` Nick Roberts
1999-02-08 0:00 ` John English
1999-02-02 0:00 ` Richard D Riehle
1999-02-03 0:00 ` robert_dewar
1999-02-01 0:00 ` Matthew Heaney
1999-02-01 0:00 ` Alexy V Khrabrov
1999-02-01 0:00 ` Matthew Heaney
1999-02-01 0:00 ` Jeff Carter
1999-02-01 0:00 ` Jeff Carter
1999-02-08 0:00 ` Michael F Brenner
1999-02-05 0:00 ` Corey Minyard
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox