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 X-Google-Thread: 103376,234e4d39a0d51d02,start X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: [student] Help with generic procedures. Date: 1998/05/23 Message-ID: #1/1 X-Deja-AN: 355998856 Content-Transfer-Encoding: 8bit References: <356793DA.820C4A50@iinet.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Newsgroups: comp.lang.ada Date: 1998-05-23T00:00:00+00:00 List-Id: In article <356793DA.820C4A50@iinet.net.au>, Oliver White wrote: >> �� generic >> ����� with procedure Process(O: Object_T); >> ����� procedure Traverse(T: Tree); >> ����� -- Visit each node and process it's data >> ����� procedure Leaf_Traverse(T: Tree); >> ����� -- Visit each leaf node and process it's data. >> >But when I compile the package body it doesn't recognise Process as a >generic procedure of Leaf_Traverse. How would I rewrite this part of the >spec to allow Leaf_Traverse to use the generic "Process"? The way you've written it, it's very misleading. The issue is that you really have generic with procedure Process (...); procedure Traverse (T : Tree); procedure Leaf_Traverse (T : Tree); In other words, you've actually declared two different procedures, one that's generic (Traverse), and one that's not (Leaf_Traverse). Make up your mind about how many generic subprograms you want. If you want two, then do this generic with procedure Process ...; procedure Traverse (T : Tree); generic with procedure Process ...; procedure Leaf_Traverse (T : Tree); Matt P.S. Can you get rid of all this gobbledygook below? > >I have this in my package spec: >
  >
>
   generic
>      with procedure Process(O: Object_T);
>      procedure Traverse(T: Tree);
>      -- Visit each node and process it's data
>      procedure Leaf_Traverse(T: Tree);
>      -- Visit each leaf node and process it's
data.
>
>But when I compile the package body it doesn't recognise Process as a generic >procedure of Leaf_Traverse. How would I rewrite this part of the spec to >allow Leaf_Traverse to use the generic "Process"?
>
>
I'm running on >
Win 95, P133, 32MB RAM >
  > >--------------8A52D5678832CDBEB46DE800--