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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,81ea1855a67f537a X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!news.banetele.no!uio.no!newsfeed1.fi.sn.net!fi.sn.net!newsfeed2.fi.sn.net!news.song.fi!not-for-mail Date: Fri, 01 Feb 2008 10:49:04 +0200 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: declaration of an incomplete private type before the private part References: <5e8bc9cb-a2c1-4c9c-8308-ca8b709801f5@e23g2000prf.googlegroups.com> In-Reply-To: <5e8bc9cb-a2c1-4c9c-8308-ca8b709801f5@e23g2000prf.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <47a2d8fd$0$23828$4f793bc4@news.tdc.fi> Organization: TDC Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1201854717 news.tdc.fi 23828 81.17.205.61:32794 X-Complaints-To: abuse@tdcnet.fi Xref: g2news1.google.com comp.lang.ada:19673 Date: 2008-02-01T10:49:04+02:00 List-Id: Javi wrote: > My problem: I need to do a declaration such as: > > ----------------------------------------- > ... > type ListNode is private; > type List is private; > > package IterList is new Iterators (Creator => List, > Item => ListNode, > getFirst => Lists.getFirst, > getNext => Lists.getNext, > isLast => Lists.isLast); > > function makeIter (L : List) return IterList.Iterator; > ... > private: > (complete declaration of ListNode and List) > ----------------------------------------- > > > The problem is that I need to complete the type (ListNode and List) > before instancing the new package. But I do not know how to do that! > The only solution I have found is to declare the types non-private and > then give them the complete declaration. Obviously, this solution does > not satisfy me since I want to make the types private. As I understand it, you want to instantiate the Iterators package before the "private" part, because you want to use the type Iterator, defined in the instance, in the declaration of public oeprations (makeIter). One way to work around this problem is to define a new type for that purpose: type ListNode is private; type List is private; type ListIterator is private; -- Added. function makeIter (L : List) return ListIterator; private type ListNode is ... -- Complete declaration. type List is ... -- Complete declaration. packate IterList is new Iterators (....); -- As above. type ListIterator is new IterList.Iterator; HTH, -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .