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 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,ASCII Path: g2news2.google.com!postnews.google.com!b25g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Discriminant and type extensions Date: Mon, 5 Oct 2009 15:04:01 -0700 (PDT) Organization: http://groups.google.com Message-ID: <42a46538-2430-4738-9cb4-7cbbb0c7db33@b25g2000prb.googlegroups.com> References: <2b205c63-55e7-4cef-95d2-5b0ece0b8866@p9g2000vbl.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1254780242 9025 127.0.0.1 (5 Oct 2009 22:04:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 5 Oct 2009 22:04:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b25g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8589 Date: 2009-10-05T15:04:01-07:00 List-Id: On Oct 5, 1:42=A0pm, Robert A Duff wrote: > "Hibou57 (Yannick Duch=EAne)" writes: > > > > > > > I was looking at two of my generic packages, fully functionals, that > > is not the trouble, but not expressive enough IMHO. > > > The lack, from my point of view, is in the way a type can be extended > > from a another type with discriminants. > > > What I mean : I've got a type in a package, a tagged type with > > discriminants. Then a second package extends this type, but the > > discriminants from the extended type does not appears in the extension > > declaration. When I want to instantiate the type (the extended one), I > > obviously have to provide the actuals for these discriminants (the > > ones coming from the type which was extended). > > > What do you think about it ? > > > Do you think it would be a good proposal to allow the discriminant to > > be explicitly recalled in an extension declaration ? (just to be more > > explicit and expressive) > > I'm not sure exactly what you mean, but you can do things like this: > > =A0 =A0 type T (D : Positive) is tagged ... > =A0 =A0 type T2 (D : Positive; D2 : Boolean) is new T(D =3D> D); > =A0 =A0 type T3 is new T(D =3D> 1_000_000); > =A0 =A0 type T4 (D2 : Boolean) is new T(D =3D> 1_000_000); Well, you can't do any of the last three, since you need an extension part. But we'll assume you meant to include one. :) I think he wants to try to duplicate the discriminants for documentation purposes (for clarity), so that type T (D : Positive) is tagged ... type T2 (D : Positive) is new T with ... -- [A] where, I assume, the compiler would check to make sure the discriminant part of T2 was something-conformant with that of T, and the declaration would be semantically identical to type T2 is new T with ... It (line [A]) isn't currently legal, but this is: type T2 (D : Positive) is new T (D=3D>D) with ... However, I'd need to stare at the RM for some time to convince myself that this is semantically identical in all cases to the simple "type T2 is new T with...". (And then I might have to open the RM and read it after I'm done staring at it.) Maybe it really is identical, and all uses of T2 would have identical semantics in all cases. I'm not sure. -- Adam