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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,399666c22a39304c,start X-Google-Attributes: gid103376,public From: Richard Irvine Subject: Translate this into Ada ... Date: 1996/08/20 Message-ID: <3219E6E2.2F5@eurocontrol.fr>#1/1 X-Deja-AN: 175534133 content-type: text/plain; charset=us-ascii organization: Eurocontrol Experimental Centre, Bretigny-Sur-Orge, France mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/755) Date: 1996-08-20T00:00:00+00:00 List-Id: 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.