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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7350da5176edec2c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-24 10:58:55 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.arcor-online.net!newsfeed.r-kom.de!newsfeed.stueberl.de!newspeer1-gui.server.ntli.net!ntli.net!news11-gui.server.ntli.net.POSTED!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada Subject: In a pickle. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Wed, 24 Jul 2002 18:58:12 +0100 NNTP-Posting-Host: 80.5.140.234 X-Complaints-To: abuse@ntlworld.com X-Trace: news11-gui.server.ntli.net 1027533531 80.5.140.234 (Wed, 24 Jul 2002 18:58:51 BST) NNTP-Posting-Date: Wed, 24 Jul 2002 18:58:51 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:27366 Date: 2002-07-24T18:58:12+01:00 List-Id: Hi, Is there a resolution to the following problem that allows convienant assignment of iterators? An iterator points to a node in a list, like this -- Bi-Directional Iterator definition for positions within -- objects of List_Type. -- type Iterator_Type is new Ada.Finalization.Controlled with record List : List_Base_Access; Position : Node_Access; end record; While more than one iterator points to a node it cannot be deallocated, with the number of iterators pointing to the node, recorded in the node itself. The problem is assignment! If we do Iterator := Next (Iterator); The iterator is assigned to the next position, but the count of iterators isn't decremented so the node always thinks an iterator is on it. I've just noticed something in Cohen that may help but am not sure if my interpretation is correct. At the top of page 573 he says "The target variable in an assignment statement is finalized just before a new value is about to be copied to that variable". Does this mean that in the above assignment Iterator is finalized after Next (Iterator) is evaluated but before the assignment takes place? That would mean that a suitably coded finalize would do the job, correct? Chris