From: Eric B. <er...@go...> - 2008-03-20 21:18:27
|
Berend de Boer wrote: >>>>>> "Eric" == Eric Bezault <er...@go...> writes: > > Eric> Well, in fact to iterate only on keys I guess we can do > Eric> `my_table.keys.do_all'... So, we might need only two kinds of > Eric> iterators after all. What about `do_all' and > Eric> `do_all_with_key', the latter being similar to > Eric> `do_all_with_index'? > > Or for_each which gives both item and key, and for_each_item which only > does the item? > > What I try to come up with is the shortest name, the default, for the > most common method. And a slightly longer for the other. > > Or else, a name with both key and item is longer, so make it the default > when nothing is in the feature name, as it is really hard to indicate > you get both, so you can put that in the comments. > > And iterating while receiving a single feature is then simply > for_each_item/for-each_key. I think that we are better off using the same names as in EiffelBase. EiffelBase uses `do_all' and `do_all_with_index'. I think that `do_all_with_key' follows this pattern. Also, if in linear we had `for_each' which gets the items, I would not want that name to be changed to `for_each_item' in tables or in arrays (so that `for_each' could now, inconsistently, get items and keys in tables or items and indexes in arrays). -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |