Re: Backward iterators

Colin Paul Adams <[email protected]> Sat, 01 Nov 2008 18:07:35 +0000
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
>>>>> "Eric" == Eric Bezault <[email protected]> writes:

    Eric> I thought about that as well. I think that I was the first
    Eric> one to explicitly state in the header comments that the
    Eric> iterators are traversing from first to last. Which of course
    Eric> raises the issue that we miss the iterators from last to
    Eric> first. We also probably miss a few other possible iterators

There is a class in EiffelBase, called something like LINEAR_ITERATOR
that has a whole lot of variants. It might be worth taking a look at
(but with caution - when I last looked at it, it was a real mess - at
least as far as contracts went. i raised the issue with Manu, and they
did something about it, but i haven't looked at it to see what0.

    Eric> such as do_until.  Any naming convention for the backward
    Eric> iterator feature names?

*_backwards seems straight-forward.

E.g do_all_backwards, do_if_backwards and do_all_with_index_backwards
all read ok.

It would be more compact to drop the all, but then we get an
inconsistent pattern:

do_backwards, do_if_backwards, do_backwards_with_index.

Still, I think I prefer these shorter names.
If we were starting from scratch, I would definitely go for this,
along with fo_forwards, etc., rather than do_all.
-- 
Colin Adams
Preston Lancashire

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/