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,bfbc780dd8e1c97c X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Question about generic formal derived types Date: 1999/03/30 Message-ID: #1/1 X-Deja-AN: 460842311 References: <7dpgl4$h2j$1@nnrp1.dejanews.com> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1999-03-30T00:00:00+00:00 List-Id: adam@irvine.com writes: After adding a spec for Pack4, running this thru ObjectAda 7.1.2 gives the error: adam.adb: Error: line 32 col 67 LRM:8.3(26), Illegal to override declaration in same region, Introducing new declaration anyway (In instance of generic Pack2 at adam.adb: line 13 col 9) I believe that answers all your questions :). -- Stephe > In this program fragment: > > ------------------------------------------------------------------------------- > package Pack1 is > type Root_Type is tagged record > Field1 : Integer; > Field2 : Boolean; > end record; > end Pack1; > > with Pack1; > generic > type Formal_Type is new Pack1.Root_Type with private; > package Pack2 is > type New_Type is new Formal_Type with record > Field3 : Character; > end record; > end Pack2; > > with Pack1; > package Pack3 is > type Root_Type_Extension is new Pack1.Root_Type with record > Field3 : Float; > end record; > end Pack3; > > . . . > > with Pack2; > with Pack3; > package body Pack4 is > > package Instantiation is new Pack2 (Pack3.Root_Type_Extension); > > procedure Inner is > X : Character; > Y : Instantiation.New_Type; > begin > X := Y.Field3; > end Inner; > > end Pack4; > > ------------------------------------------------------------------------------- > > I can't believe that a record type can have two components of the same name, > but it appears that Instantiation.New_Type would have two components named > Field3. > > When Y.Field3 is accessed, which Field3 is meant? > > Which language rules in the RM govern this situation? > > -- thanks, Adam > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own