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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,13aaae984988cb0d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!z34g2000vbl.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Yannick_Duch=EAne_Hibou57?= Newsgroups: comp.lang.ada Subject: Re: Discriminant and type extensions Date: Tue, 6 Oct 2009 23:20:15 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7ca423de-7ccf-492a-acc1-875b6da695aa@z34g2000vbl.googlegroups.com> References: <2b205c63-55e7-4cef-95d2-5b0ece0b8866@p9g2000vbl.googlegroups.com> <42a46538-2430-4738-9cb4-7cbbb0c7db33@b25g2000prb.googlegroups.com> <13d2a00f-4774-4860-95fa-5228389259b1@f10g2000vbf.googlegroups.com> <220c069a-a09c-413f-811c-d3b00e1b6d7e@o13g2000vbl.googlegroups.com> <0d9da8c4-ab17-42b0-99ea-09ecf02435e5@x6g2000prc.googlegroups.com> NNTP-Posting-Host: 77.198.58.88 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1254896416 2359 127.0.0.1 (7 Oct 2009 06:20:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 7 Oct 2009 06:20:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z34g2000vbl.googlegroups.com; posting-host=77.198.58.88; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8596 Date: 2009-10-06T23:20:15-07:00 List-Id: On 6 oct, 01:08, Adam Beneschan wrote: > then take the (Discriminant =3D> Discriminant) off the *private* > extension declaration. =A0I.e.: > > =A0 type Extension_Type (Discriminant : Natural) is > =A0 =A0 =A0new P1.T_Type > =A0 =A0 =A0with private; > > But leave it on the full declaration: > > =A0 type Extension_Type (Discriminant : Natural) is > =A0 =A0 =A0new P1.T_Type (Discriminant =3D> Discriminant) > =A0 =A0 =A0with null record; > > See if that works. Yes, it works The message was indeed about statically matching constraint Just beside, not directly related to this topic, but related to making things explicit, I've found an nice way to recall about abstract methods to be implemented by derived type. If a base type is defined in a package and it is derived in a second package, if it leaves some abstract methods undefined (still to be given a concrete implementation), it can be show using both the Overriding and Abstract clauses on the same declaration. Here is an working example : package P1 is type Base_Type is abstract tagged private; procedure Abstract_Method (Entity : Base_Type) is abstract; private type Base_Type is abstract tagged null record; end P1; with P1; package P2 is type Derived_Type is abstract new P1.Base_Type with private; overriding procedure Abstract_Method (Entity : Derived_Type) is abstract; -- Recalls about the inherited abstract method. -- Using both =93 overriding =94 and =93 abstract =94 is -- handled as expected : it does not create an -- homonymous method and really makes reference -- to the inherited one, thanks to the =93 overriding =94, -- and clearly states it has no concrete implementation -- thanks to the =93 abstract =94. private type Derived_Type is abstract new P1.Base_Type with null record; end P2;