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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,93ab7fc5388e249 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-05 13:22:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C0E1FA1.45A38A75@brighton.ac.uk> <%7sP7.49836$xS6.82296@www.newsranger.com> Subject: Re: List container strawman 1.3 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Wed, 05 Dec 2001 21:22:14 GMT NNTP-Posting-Host: 204.127.202.216 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1007587334 204.127.202.216 (Wed, 05 Dec 2001 21:22:14 GMT) NNTP-Posting-Date: Wed, 05 Dec 2001 21:22:14 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:17471 Date: 2001-12-05T21:22:14+00:00 List-Id: "Ted Dennison" wrote in message news:%7sP7.49836$xS6.82296@www.newsranger.com... > In article <3C0E1FA1.45A38A75@brighton.ac.uk>, John English says... > > > >Why does the iterator type need to be controlled? What's your mental > >model of what an iterator consists of? Mine generally says that an > > An iterator doesn't but a *safe* iterator does (as the list needs to know when > its iterators go away). Ted, why does a list need to "know" when its iterators go away? Did you mean to say that safe iterator needs to know when its list has gone away? If so, a more lightweight approach is to use an access discriminant denoting the list, e.g.: type Iterator (My_List : access List) is limited record My_Item : Item_Ptr; end record; Then it is simply impossible for an Iterator to outlive its list! The lack of assignment is easily overcome: procedure Set (This : in out Iterator; To : Iterator) is begin This.My_Item := To.My_Item; end Set; since composing ":=" is probably not an issue for iterators (i.e. the ability to assign composite types having Iterator components). Best, Mark