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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a644fa9cd1a3869a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-11 11:32:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "Steven Deller" Newsgroups: comp.lang.ada Subject: RE: List container: Insert and Delete Date: Sun, 11 Nov 2001 14:29:33 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1005507141 23195 137.194.161.2 (11 Nov 2001 19:32:21 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 11 Nov 2001 19:32:21 +0000 (UTC) To: Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal In-Reply-To: <3BEEB766.B50C969@acm.org> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:16287 Date: 2001-11-11T14:29:33-05:00 > -----Original Message----- > From: comp.lang.ada-admin@ada.eu.org > > However, I'm pretty sure that trying to do insertions and deletions > > while iterating through a list fails both (a) and (b) miserably. > > That's what I was trying to get across. > > I agree that one should not be doing insertions and deletions > while iterating over a list. Iterators should not allow this, > and positions should generally not be used for iteration. > > -- > Jeff Carter I don't understand this comment. It seems to me that iteration to find some value and then insertion at that point is a normal list operation. I see no difficulty with iteration doing inserts and deletes, even with other simultaneous iterators. It is a simple matter to define the semantics to be unambiguous, particularly if you use positions that are "in between" elements and semantics like: delete following item delete preceding item get value of following item get value of preceding item move to next position (skip over an element) move to previous position (skip backwards over an element) goto head of list (position before first item) goto tail of list (position after last item) is at end of list (boolean) is at beginning of list (boolean) These are all well defined, even for empty lists. Regards, Steve Deller