comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: default formal parameters in generic declarations
Date: Mon, 3 Mar 2008 10:17:35 +0100
Date: 2008-03-03T10:17:35+01:00	[thread overview]
Message-ID: <1qlkyebn1yxut$.1r1eauouyt3l8$.dlg@40tude.net> (raw)
In-Reply-To: a520f018-097c-406b-a3e3-387a28d38216@s8g2000prg.googlegroups.com

On Sun, 2 Mar 2008 11:40:38 -0800 (PST), Eric Hughes wrote:

> Eric Hughes <eric....@gmail.com> writes:
>> Formal
>> objects and subprograms can have default values.  Formal types and
>> packages cannot.  Could someone point me to the discussion where this
>> inconsistency was decided to be a good thing?
> 
> On Mar 2, 10:42 am, Robert A Duff <bobd...@shell01.TheWorld.com>
> wrote:
>> It is not a good thing.
> 
> The absence of this expression is not a good thing, but my question
> was more about the tradeoffs, not in the language itself, but in the
> whole context of the creation of the language.  Was it considered too
> late to be understood?  Were there too many prerequisites?  Was not a
> high enough priority?  _On balance_ it must have been a good thing,
> because it didn't happen.  I am assuming it was considered.

I don't know anything about how the decision was made, but a default
package "value" would require in my view certain mechanisms Ada presently
lacks. In order to be usable the "value" should take actuals of other
formal parameters:

generic
   type A is ...;
   with package B is new Boo (A) := Default; -- Default depends on A
package Foo is ...

Here Default is in fact a generic package rather than an instance of. There
could be many ways to resolve this, from automatic instantiation (certainly
not Ada) to conditional instantiations of defaults within the specification
part of Foo (might be problematic due to visibility issues). 

IMO, it is better (as always) to get rid of generics. Default values of
packages are in fact inheritable interfaces. Thus inheritance should be the
way. I would extend this part of the language rather than generics.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-03-03  9:17 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 [this message]
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
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