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,fd8f3d2ebf73a4b7,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-21 07:17:53 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Whether to raise exception or End_of_List function Date: Wed, 21 Nov 2001 15:17:52 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1006355872 11717 129.241.83.82 (21 Nov 2001 15:17:52 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Wed, 21 Nov 2001 15:17:52 +0000 (UTC) User-Agent: slrn/0.9.7.2 (Linux) Xref: archiver1.google.com comp.lang.ada:16791 Date: 2001-11-21T15:17:52+00:00 List-Id: Hi I have made a simple double linked list that I use in the application I develop. Before somebody suggest I use some other libraries I want to say that I made this double linked list to learn Ada 95 and get aware of different problems/aspects of implementing this, so at least for this application I want to keep it for now. The list code can be viewed here: http://www.pvv.org/~randhol/Ada95/List/ Note that the code is still rough, I haven't removed some debugging functions/procedures etc... I put this into a package: package Examine_List is new Double_Linked_List (Data_Type => Natural); Main_Examine : Examine_List.List_Type := Examine_List.New_List; And use the Main_Examine. So far it has worked nicely, but now I came to that at one place (at least) in my application I have to go from the current position of the iterator until the end of the list. I cannot know the current position of the list iterator so I cannot use a for-loop. If I want to use a while loop however there are the problem of knowing when the end of the list is reached. I guess I can make a function End_of_List (which must also work if one try to backwards in the list) or I can just raise an exception when the user tries to step off the list. My question is which is the better solution; Exception or a End_of_List function and which would have fewer side effects? Thanks in advance. Preben -- () Join the worldwide campaign to protect fundamental human rights. '||} {||' http://www.amnesty.org/