comp.lang.ada
 help / color / mirror / Atom feed
* Whether to raise exception or End_of_List function
@ 2001-11-21 15:17 Preben Randhol
  2001-11-21 16:32 ` Preben Randhol
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Preben Randhol @ 2001-11-21 15:17 UTC (permalink / raw)


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/



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-11-23 14:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-21 15:17 Whether to raise exception or End_of_List function Preben Randhol
2001-11-21 16:32 ` Preben Randhol
2001-11-21 16:51 ` Mark Biggar
2001-11-21 17:00   ` Preben Randhol
2001-11-21 17:01 ` Larry Kilgallen
2001-11-21 17:03   ` Preben Randhol
2001-11-21 19:34   ` Ed Falis
2001-11-21 17:04 ` chris.danx
2001-11-21 17:09   ` chris.danx
2001-11-21 22:00   ` Larry Kilgallen
2001-11-21 17:11 ` Jeffrey Carter
2001-11-21 17:53 ` Stephen Leake
2001-11-21 18:51   ` Preben Randhol
2001-11-22  3:53     ` Nick Roberts
2001-11-22 10:23       ` Preben Randhol
2001-11-23 14:37       ` Preben Randhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox