comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Irvine <Richard.Irvine@eurocontrol.fr>
Subject: Translate this into Ada ...
Date: 1996/08/20
Date: 1996-08-20T00:00:00+00:00	[thread overview]
Message-ID: <3219E6E2.2F5@eurocontrol.fr> (raw)


Can anyone help with what I imagine is a frequently ocurring problem?

We would like all lists in an application to be read using an iterator
with operations like:

  function  theCurrentItem( theIterator :        Iterator ) return
ItemType;
  function  atTheEnd      ( theIterator :        Iterator ) return
Boolean;
  procedure goToTheNext   ( theIterator : in out Iterator );

Furthermore, since an iterator has to be created for a particular list
and since the implementation of an iterator is dependent on that of the
list 
we would like all list types to have a (constructor) operation like

  function  aNewIteratorFor( theList : List ) return Iterator;

This design decision should apply to all types of list, regardless of
the ItemType and regardless of the implementation of the lists.

How using generics, abstract types (e.g. AbstractList and
AbstractIterator), 
abstract subprograms or any other Ada features can this decision be
expressed? 

I have struggled with this for quite some time without finding a
satisfactory
solution. Any suggestions gratefully received.




             reply	other threads:[~1996-08-20  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-20  0:00 Richard Irvine [this message]
1996-08-21  0:00 ` Translate this into Ada Norman H. Cohen
1996-08-22  0:00   ` Richard Irvine
1996-08-22  0:00     ` Richard Irvine
1996-08-22  0:00     ` Norman H. Cohen
1996-08-29  0:00   ` Robert A Duff
1996-08-21  0:00 ` David Weller
  -- strict thread matches above, loose matches on Subject: below --
1996-08-21  0:00 Spasmo
1996-08-21  0:00 ` Richard Irvine
1996-08-28  0:00   ` Robert A Duff
replies disabled

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