Iterators/vectors (was: [Biocorba-l] BSANE and bioCORBA)

Alan Robinson alan@ebi.ac.uk
Fri, 1 Jun 2001 17:40:51 +0100 (GMT Daylight Time)


On Fri, 1 Jun 2001, Juha Muilu wrote:

> Michael Dickson wrote:
> > 
> > If I had to change anything about it (and we don't :)  I'd replace the
> > typesafe iterators with one generic one.  Its a small point but the
> > other methods generates lots of stubs and skeletons (for languages that
> > have them).  I generally prefer type safety but in practice this proved
> > to be a bit of a pain.  So the code you'd likely see would look like:
> 
> I agree with you. We have found current type safe iterators bit pain as
> well.
> 
> > 
> > Object obj;
> > while (someIterator.next(&obj)) {
> >   TypedObj tobj = TypedObjHelper.narrow(obj);
> >   tobj.dostuff();
> > }
> > 
> > Instead of:
> > 
> > TypedObject obj;
> > while (someIterator.next(&tobj)) {
> >   tobj.dostuff();
> > }
> > 

OK - I'm not a big fan of non-type safe iterators and any's, for a number
of (possibly biased & incorrect) reasons:

 - I like to know what I'm dealing with up front, not at run time, if I
   can help it.
 - I'm not quite sure of the status of 'any' implementations outside of
   Java. Can anyone comment?
 - Using any's suddenly exposes the fact you're using CORBA with its
   associated helper classes. (I like my CORBA to be invisible).



Alan.