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,3162283879cdc5f2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII X-Received: by 10.224.200.202 with SMTP id ex10mr23483000qab.8.1368629045744; Wed, 15 May 2013 07:44:05 -0700 (PDT) X-Received: by 10.50.25.33 with SMTP id z1mr1221081igf.16.1368629045650; Wed, 15 May 2013 07:44:05 -0700 (PDT) Path: y6ni43806qax.0!nntp.google.com!m7no7601181qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 15 May 2013 07:44:05 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <309db8ab-239d-4b06-9450-3a0b098f3953@googlegroups.com> Subject: Re: Type vs subtype about visibility of parent's private full definition From: Adam Beneschan Injection-Date: Wed, 15 May 2013 14:44:05 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-05-15T07:44:05-07:00 List-Id: On Wednesday, May 15, 2013 1:13:00 AM UTC-7, Hibou57 (Yannick Duch=EAne) wr= ote: > Hi all, >=20 > I already encountered something similar in the past, and it's back again.= =20 > I can only solve it using a subtype instead of a type-new where I =20 > initially want a type-new, so I'm not happy with using subtype. >=20 > The case: a child package don't see the full definition of a type from th= e =20 > private part of its parent package when it derives from that type as a = =20 > type-new. >=20 > Below is an example, using a discriminant, which is not required to expos= e =20 > the visibility issue, but which is the reason why I'm not happy to not be= =20 > able to derive a type-new instead of a subtype: I can't force static-chec= k =20 > as I expected. If the discriminant was not part of the party, I won't =20 > bother. That's the reason why the example makes use of a discriminant and= =20 > I see the case as an issue. > Example: > package Parents is > pragma Pure;=20 > type Discriminant_Type is > range 1 .. 5; >=20 > type Instance_Type > (Discriminant : Discriminant_Type) is > private; >=20 > private > type Instance_Type > (Discriminant : Discriminant_Type) is > record > Value : Integer; > end record; > end Parents; >=20 > package Parents.Childs is > pragma Pure; > subtype Parent_Type is > Parents.Instance_Type; > type Instance_Type is > new Parent_Type > (Discriminant =3D> 2); > function Value > (Object : Instance_Type) > return Integer; > private > function Value > (Object : Instance_Type) > return Integer > is (Object.Value); -- << Error here > end Parents.Childs; >=20 >=20 > I did not check the RM, however I'm blocked if I do this, as GNAT has =20 > complaints with `is (Object.Value)`, and grumbles: >=20 > no selector "Value" for private type derived from "Instance_Type" > What are your opinions about this issue? 7.3.1(4) says that the Value component should be visible at that point. Th= is is a compiler bug. -- Adam