comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: default formal parameters in generic declarations
Date: Thu, 06 Mar 2008 10:32:26 +0100
Date: 2008-03-06T10:32:26+01:00	[thread overview]
Message-ID: <47cfba2a$0$14412$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <0078161e-64c7-4fa8-9794-b840d855a88b@q78g2000hsh.googlegroups.com>

Eric Hughes wrote:

> Even with just two layer of instantiation this is feasible, but, in
> the phrase I used earlier, "horribly klunky" (particularly with non-
> linear references).  So here's the biggest problem: You cannot get
> simultaneously both arbitrarily deep layering and concision in formal
> parameters for ordinary usage.

By way of speculation, can nesting, to the extent it is absent from C++,
lead to at least a partial solution of this problem?

package News4 is

   type Performance_Tuning is interface;

   function Null_Tuning return Performance_Tuning'Class;

   generic
      Tuner: Performance_Tuning'Class := Null_Tuning;
   package B is

      generic
         Tuner: Performance_Tuning'Class := B.Tuner;
      package A is end;

   end B;

end News4;


To some extent, this view would require building software with "towers"
of building blocks in mind, rather than patterns of cobblestone, so to
speak.


> As a coda, I wish to add that this practice is not hypothetical.  The
> sophistication of some of the generic (template) programming in the
> Boost C++ library is excellent and worth imitating.

Again by way of speculation, and as an example, the Boost
parsing facilities have a counterpart in Ada that just works
differently, using access to nested functions.
GNAT.Spitbol.Patterns solves the same practical problems
as the spirit parsers, and more. There might be a small
overhead because pattern construction does not occur at
compile time, but then Spitbol.Patterns is actually more powerful.

I'm noting all this only because I should think there is some value
in nesting that, just maybe, is easily overlooked.




  reply	other threads:[~2008-03-06  9:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 17:21 default formal parameters in generic declarations Eric Hughes
2008-03-02 17:42 ` Robert A Duff
2008-03-02 19:40   ` Eric Hughes
2008-03-03  9:17     ` Dmitry A. Kazakov
2008-03-03 11:15       ` Georg Bauhaus
2008-03-03 13:56         ` Dmitry A. Kazakov
2008-03-04 16:15       ` Eric Hughes
2008-03-04  3:43     ` Randy Brukardt
2008-03-04 16:51       ` Eric Hughes
2008-03-04 18:43         ` Randy Brukardt
2008-03-05 21:08           ` Eric Hughes
2008-03-06  9:32             ` Georg Bauhaus [this message]
2008-03-06 18:05               ` Eric Hughes
2008-03-06 22:41                 ` Ludovic Brenta
2008-03-07 10:51                   ` Georg Bauhaus
2008-03-07 20:09                     ` Eric Hughes
2008-03-03 12:42 ` Stephen Leake
2008-03-04 13:50   ` Dr. Adrian Wrigley
2008-03-04 16:56     ` Eric Hughes
2008-03-04 16:44   ` Eric Hughes
2008-03-05 13:11     ` Stephen Leake
2008-03-05 21:41       ` Eric Hughes
replies disabled

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