comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: default formal parameters in generic declarations
Date: Wed, 05 Mar 2008 08:11:31 -0500
Date: 2008-03-05T08:11:31-05:00	[thread overview]
Message-ID: <u4pblz56k.fsf@stephe-leake.org> (raw)
In-Reply-To: 412874f9-9ddb-4aea-ac45-b366b0b1e68a@u10g2000prn.googlegroups.com

Eric Hughes <eric.eh9@gmail.com> writes:

> Eric Hughes <eric....@gmail.com> writes:
>> I would like to implement this in Ada, but the absence of a default
>> package parameter means that instantiation is horribly clunky and that
>> only the most dedicated would use it.
>
> On Mar 3, 5:42 am, Stephen Leake <stephen_le...@stephe-leake.org>
> wrote:
>> I don't see why this would be "horribly klunky"; they typical user
>> will do:
>
> For a single package instantiation, a default formal package would
> have the same benefit as a default formal subprogram.  It removes from
> a programmer's mind a detail that may not be relevant, and it removes
> from a less-experienced such mind a barrier to entry.

Right.

> I said "horribly klunky" specifically in reference to instantiation of
> aspects.  The problem arises because, in general, an aspect _ought_ to
> have access to the internal state of the package for which it is
> acting as an aspect.  

Right. That's one reason I don't think aspect-based programming is all
that useful.

> That means that a base package requires an aspect parameter to
> instantiate it at the same time as the aspect requires a base
> package to instantiate it. The hard problem I had to figure out was
> how to avoid infinite regression. 

Ok.

> In C++, the solution was to rely upon a detail of template
> instantiation where a self- reference to a class itself with the
> template parameters of its instantiation refers _not_ to the
> templated base class but to the class being instantiated, and so
> thus creates (de facto) an anonymous type whose introduction breaks
> the regression.

Ok. Did you find a similar mechanism in Ada yet? Does limited with help?

> If that sounds complicated to understand, it is.  The minimal syntax
> to declare and to instantiate is not simple.  In fact, it's really
> quite a mess, and I couldn't figure out how to simplify it (even more--
> I have some idea that it's minimal).  Requiring an ordinary user to
> learn even some this detail simply to use the class in its ordinary
> way is a poor information-hiding practice.

Ok. I can see that this might justify "horribly klunky".

-- 
-- Stephe



  reply	other threads:[~2008-03-05 13:11 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
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 [this message]
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