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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3ed8984f81760f2e,start X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Visibility Rules For Children Date: 1998/10/26 Message-ID: #1/1 X-Deja-AN: 405144785 Sender: matt@mheaney.ni.net NNTP-Posting-Date: Mon, 26 Oct 1998 03:00:45 PDT Newsgroups: comp.lang.ada Date: 1998-10-26T00:00:00+00:00 List-Id: What are the visibility rules for children? In the code fragment below, I have a procedure, GC, that is a child of parent package GP. The child is a generic that imports generic formal type NT, derived from type T, declared in the parent package GP. The parent type T (and its derived type NT, of course) has an Integer component I. All the child operation does is set the value of that component. Yet, the compiler is telling me that the child can't see the component I of NT: (start of message) q.ads:8:04: instantiation error at gp-gc.adb:3 q.ads:8:04: undefined selector for type "NT" defined at line 6 gnatmake: "/home/matt/acl/impls/q.ads" compilation error Compilation exited abnormally with code 2 at Mon Oct 26 03:53:30 (end of message) This is unexpected, since I thought that children could see the private components of types declared in the parent. Does this have anything to do with the fact that the child is looking at a type derived from the parent type, and not at the parent type directly? Is a view conversion to the parent type always required here? This... procedure GP.GC (O : in out NT) is begin T (O).I := 1; end; ...instead of procedure GP.GC (O : in out NT) is begin O.I := 1; end; Thanks, Matt generic type FT is private; package GP is type T is tagged limited private; private type T is tagged limited record I : Integer; end record; end GP; generic type NT is new T with private; procedure GP.GC (O : in out NT); procedure GP.GC (O : in out NT) is begin O.I := 1; end; with GP; package P is new GP (Integer); with P; with GP.GC; package Q is type NT is new P.T with null record; procedure C is new P.GC (NT); end; with Q; procedure Test_Q is begin null; end;