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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1c4bf3a1bd5d40f3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-07 21:27:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!peer1.news.newnet.co.uk!news-peer.gradwell.net!not-for-mail Newsgroups: comp.lang.ada From: porton@ex-code.com (Victor Porton) Date: Fri, 08 Nov 2002 10:21:15 +0500 References: <3dc92622$0$308$bed64819@news.gradwell.net> Subject: Re: Booch: missing r/w access through iterators Mime-Version: 1.0 X-Newsreader: knews 1.0b.1 Content-Type: text/plain; charset=us-ascii Message-ID: <3dcb4b43$0$307$bed64819@news.gradwell.net> NNTP-Posting-Date: 08 Nov 2002 05:27:31 GMT NNTP-Posting-Host: 195.149.39.13 X-Trace: 1036733251 news.gradwell.net 307 mail2news/195.149.39.13 X-Complaints-To: news-abuse@gradwell.net Xref: archiver1.google.com comp.lang.ada:30567 Date: 2002-11-08T05:27:31+00:00 List-Id: In article , Simon Wright writes: > porton@ex-code.com (Victor Porton) writes: > >> I noticed Access_Current_Item, but with it to gain such access one >> needs to create a new procedure! Too bad. I want direct access like: >> >> function Current_Item_Access(It: Iterator'Class) return Item_Access; > > I can see why you might want it, and at the moment I can't remember > why it's not there. Perhaps something to do with the problem of > creating the access value? (it would force the item in the Container > to be aliased, thus constraining it .. I know this actually happens in > the BCs but I was very unhappy with the necessary kluge). So, if you insist on not aliased container items in general, you however can (and please do so): 1. Add procedure to assign a value to the current item: procedure Assign_Current_Item (It : Iterator; Value : Item) is abstract; -- Alternatively it can be not abstract but using Iterator_Operations -- (see below). 2. For every iterator type add the following generic subpackage (in the same package as the corresponding iterator type): generic It: in out Iterator'Class; package Iterator_Operations is Element: Item renames ...; -- The container element to which It refers. end Iterator_Operations; where "..." is different for each iterator type.