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,7350da5176edec2c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-25 15:33:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.r-kom.de!newsfeed.stueberl.de!newspeer1-gui.server.ntli.net!ntli.net!newsfep3-gui.server.ntli.net.POSTED!53ab2750!not-for-mail From: "chris.danx" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020721 X-Accept-Language: en-gb, en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In a pickle. References: <3D3F0E27.9080303@worldnet.att.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Inktomi-Trace: pc3-bbrg1-2-cust234.ren.cable.ntl.com 1027636395 13129 80.5.140.234 (25 Jul 2002 22:33:15 GMT) Message-ID: Date: Thu, 25 Jul 2002 23:32:38 +0100 NNTP-Posting-Host: 80.3.128.4 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep3-gui.server.ntli.net 1027636395 80.3.128.4 (Thu, 25 Jul 2002 23:33:15 BST) NNTP-Posting-Date: Thu, 25 Jul 2002 23:33:15 BST Organization: ntl News Service Xref: archiver1.google.com comp.lang.ada:27412 Date: 2002-07-25T23:32:38+01:00 List-Id: Jim Rogers wrote: > > That is my understanding of how assignment works. Thanks. > Jim Rogers > Try posting this again (for the third time). :( The task of implementing iterators is proving very difficult, can anyone please offer some guidance/pointers? I want operations on a node which would invalidate iterators to take place only when one iterator references a node. For example deleting a node should only occur when one, and only one iterator points to it (if more than one iterator points to the node an exception should occur). First I tried a scheme involving counting the number of iterators that reference a node, but this approach lead to a very complex implementation, so it's back to the drawing board. :( One difficulty encountered is in signalling that we are done with a node. Suppose the statement Iterator := Next (Iterator); is allowed. Prior to the call Iterator points to a node in the list (if it did not Next would raise Invalid_Iterator_Error), which it will leave after the assignment. The node needs to know an iterator has left, but how? Finalize can decrement the counter but it's difficult to control exactly when. Consider this... function Next (Iterator : in Iterator_Type) return Iterator_Type is Temp : Iterator_Type; begin ... return Temp; end Next; After return Temp; Temp will be finalized so we need to record that temp is just temporary. Then we have the problem of intelligently adjusting the iterator on the left hand-side. :( Now I know why John English skipped the issue in "ada: the craft..." (I didn't fully appreciate Johns' warning on this) and why other list implementations either skip the issue or are quite complex. Is there a better solution to this problem??? Thanks for your time, Chris