From: Eric B. <er...@go...> - 2008-11-01 20:00:35
|
Colin Paul Adams wrote: >>>>>> "Eric" == Eric Bezault <er...@go...> 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. My dictionary says that Americans use "backward" instead of "backwards". > 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. We could have the forward(s) and backward(s) versions, and have `do_all' use one or the other (when people don't care about the direction of the traversal). For example in DS_CONTAINER we have `do_all' since we don't really know or care about traversal directions. In class DS_LINEAR it could be implemented using `do_forward(s)'. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |