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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,40d697764033dbdb X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: types in procedure arguments Date: 1996/10/01 Message-ID: <32512127.6550@gsfc.nasa.gov>#1/1 X-Deja-AN: 186461912 references: <5268qg$r1t@noc2.drexel.edu> <52piii$8n7@noc2.drexel.edu> content-type: text/plain; charset=us-ascii organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA mime-version: 1.0 reply-to: Stephen.Leake@gsfc.nasa.gov newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; U) Date: 1996-10-01T00:00:00+00:00 List-Id: At last! some real code. Chris Papademetrious wrote: > [snip] > Thank you for your time and energy, folks. Several people have > expressed interest in the outcome of this, and I thank you for your > help in resolving it. > > - Chris > with Tst_Double_List; -- double linked-list package > with Tst_Vectors; > > package Tst_Best_Congruence is > > package Vec_List is new Tst_Double_List(ELEMENT_OBJECT => > Tst_Vectors.Vector); > > procedure Best_Congruence > ( > List: in out Vec_List.LIST_ID > ); > > end Tst_Best_Congruence; > generic > type ELEMENT_OBJECT is private; > package Tst_Double_List is > type LIST_ID is limited private; > private > type LIST_ID is > record > Item1, Item2, Item3: ELEMENT_OBJECT; > end record; > end Tst_Double_List; > package Tst_Vectors is > type Vector is array (0..9) of Float; > end Tst_Vectors; > with Tst_Double_List; -- double linked-list package > with Tst_Best_Congruence; > with Tst_Vectors; > > procedure Tst is > > package Vec_List is new Tst_Double_List(ELEMENT_OBJECT => > Tst_Vectors.Vector); You don't want to do this second instantiation here. > L: Vec_List.LIST_ID; This should be: L : Tst_Best_Congruence.Vec_List.LIST_ID; > > begin > > Tst_Best_Congruence.Best_Congruence(L); Using full names for clarity, the "LIST_ID" type this call wants to see is Tst_Best_Congruence.Vec_List.LIST_ID (the one declared in Tst_Best_Congruence), not Test.Vec_List.LIST_ID (the one declared in Tst). In cases like this, you can always write down the full names of things to see what's going on. Instantiating a package a second time produces a distinct type, and Ada gives it a distinct name. > > end Tst; > -=-=-=-=-=-=-=-=-=-=-=-=- > Chris Papademetrious > Data Fusion Laboratory > Drexel University > Philadelphia, PA > -=-=-=-=-=-=-=-=-=-=-=-=- -- - Stephe