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,ac5c3bc59168d76 X-Google-Attributes: gid103376,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: Subprogram Renaming Date: 1996/04/12 Message-ID: <4kmgha$139s@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 147188275 distribution: world references: <316AEA8D.7600@csehp3.mdc.com> <4kgde6$q8t@watnews1.watson.ibm.com> <4kjhg2$139s@watnews1.watson.ibm.com> <316E12F2.37BC@ehs.ericsson.se> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada Date: 1996-04-12T00:00:00+00:00 List-Id: In article <316E12F2.37BC@ehs.ericsson.se>, Jonas Nygren writes: |> > package Integer_Dequeues is |> > type Dequeue_Type is private; ... |> |> procedure Remove_All (Dequeue: in out Dequeue_Type); |> |> > private |> > type Dequeue_Type is ...; |> > end Integer_Dequeues; |> > |> > with Integer_Dequeues; |> > package Integer_Stacks is |> > type Stack_Type is private; ... |> |> procedure Remove_All (Stack: in out Stack_Type); |> |> > private |> > use Integer_Dequeues; |> > type Stack_Type is new Dequeue_Type; ... |> |> procedure Remove_All (Stack: in out Stack_Type) |> renames Remove_All; -- Does not work, |> -- Gnat e.g. creates a recursive call (reported) |> |> > end Integer_Stacks; The explicit declaration of Remove_All in the visible part of Integer_Stacks hides all homographs later in the same declaration, and the version implicitly declared after the derived-type declaration is a homograph of the explicitly declared version. Thus you're trying to rename the explicitly declared Remove_All as itself. Here's an ugly solution: package Integer_Stacks is type Stack_Type is private; ... procedure Remove_All (Stack: in out Stack_Type); private package Inner is type Stack_Parent_Type is new Integer_Dequeues.Dequeue_Type; procedure Parent_Remove_All (Stack: Stack_Parent_Type) renames Remove_All; ... end Inner; type Stack_Type is new Inner.Stack_Parent_Type; procedure Remove_All (Stack: in out Stack_Type) renames Parent_Remove_All; -- Inherited from Inner.Remove_All ... end Integer_Stacks; At least the ugliness is hidden in the private part and has no runtime overhead. -- Norman H. Cohen ncohen@watson.ibm.com