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,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-10 20:06:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!ppp-1-57.cvx6.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: List container strawman Date: Sun, 11 Nov 2001 03:27:29 -0000 Message-ID: <9sktgk$134npc$1@ID-25716.news.dfncis.de> References: <3BE29AF4.80804@telepath.com> <3BE29BD4.10401@telepath.com> <3BE2DB99.B707D409@boeing.com> <3BE32A18.18404AD1@boeing.com> <3BE443DE.574D669C@acm.org> <3BE58FDD.E1FB1815@san.rr.com> <3bec1cbe$0$15824$626a54ce@news.free.fr> <9sib27$13aeg3$5@ID-25716.news.dfncis.de> <9sk5rn$140qdr$2@ID-25716.news.dfncis.de> <3BEDB57E.1203D638@otelco.net> NNTP-Posting-Host: ppp-1-57.cvx6.telinco.net (212.1.156.57) X-Trace: fu-berlin.de 1005451605 36855596 212.1.156.57 (16 [25716]) 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 Xref: archiver1.google.com comp.lang.ada:16266 Date: 2001-11-11T03:27:29+00:00 List-Id: "Larry Hazel" wrote in message news:3BEDB57E.1203D638@otelco.net... > Nick Roberts wrote: > > > > I hope you'll forgive me if I re-post the code I gave, corrected and cleaned > > up a little, and with a blow-by-blow commentary on what's going on. > > > This mostly looks very good to me except it seems terribly inefficient to have > to copy the whole list into a new list then delete the old list if all I need to > do is modify a few entries, delete a few others and insert a few. Seems as if > we still need methods to delete, update, and insert elements. In fact, I completely agree with you. It was extremely clumsy of me to simply say "you don't need inserts or delete". You do. What you don't need is insert or delete in association with an iterator (or a separate iterator type at all). All you need are straightforward insert and delete functions and procedures that identify the position of insertion or deletion with a number (type Positive), starting at 1 for the first item in the list. Detail: A container object would have three modes: seq read; seq write; normal. Calling Read or End_of_Data other than in seq read mode, or calling Write or Terminate_Data other than in seq write mode, would raise an exception (SCL.Exceptions.Mode_Error). Restart causes a switch to seq read mode. Rewrite causes a switch to seq write mode. Any other operation when not in normal mode causes a switch to normal mode. This way, non-sequential modification cannot interfere with iteration. Simple. Doing the equivalent of what my example procedure Normalize_Names did using inserts and deletes with an iterator would have ended up with code that was more difficult to program, more difficult to read, slower in execution, and (I think) more wasteful of memory. Showing this was the true purpose of my example. Admittedly, I really need to add more detail, but it's finding the time :-( -- Best wishes, Nick Roberts