From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,43f6bd9b498b66d0 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: default formal parameters in generic declarations Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <9b3bac4d-5ae1-4a1b-a81e-9aa9ae1843e0@e31g2000hse.googlegroups.com> Date: Mon, 3 Mar 2008 10:17:35 +0100 Message-ID: <1qlkyebn1yxut$.1r1eauouyt3l8$.dlg@40tude.net> NNTP-Posting-Date: 03 Mar 2008 10:17:35 CET NNTP-Posting-Host: 358eb711.newsspool2.arcor-online.net X-Trace: DXC=WSTEaFIP[?j_0Po7BmQ3]lA9EHlD;3Ycb4Fo<]lROoRaFl8W>\BH3Yb_JkgbDIXo89bI5kh X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:20169 Date: 2008-03-03T10:17:35+01:00 List-Id: On Sun, 2 Mar 2008 11:40:38 -0800 (PST), Eric Hughes wrote: > Eric Hughes 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 > 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