ITERATOR.get_new_iterator name and its usage pattern

2 messages Options
Embed this post
Permalink
Paolo Redaelli

ITERATOR.get_new_iterator name and its usage pattern

Reply Threaded More More options
Print post
Permalink
I was wondering about the choice of "get_new_iterator" in ITERATOR.

It seems to me that it does not fit Eiffel naming policies.
In fact I would have picked only "iterator" or - if we want to stress
out that it is freshly created - "new_iterator".

get_new_iterator remembers me of languages that does not follows the
Uniform-Access Principle.

I propose a renaming of "get_new_iterator" into "iterator", obviously
leaving the previous as an obsolete feature.


ITERATOR usage pattern is most of the like this:
foo is
local iter: ITERATOR[BAR]
do
        from iter:=my_collection.get_new_iterator; iter.start
        until iter.is_off
        loop
                ..... processing
                iter.next
        end
end

is there a particular reason not to provide "started_iterator",
allowing to write

foo is
local iter: ITERATOR[BAR]
do
        from iter:=my_collection.started_iterator
        until iter.is_off
        loop
                ..... processing
                iter.next
        end
end

Does such a proposal break Eiffel design-guides?

Thanks in advance for your attention
        Paolo
Georg Bauhaus

Re: ITERATOR.get_new_iterator name and its usage pattern

Reply Threaded More More options
Print post
Permalink

On 18.02.2009, at 11:43, Paolo Redaelli wrote:

>
> I propose a renaming of "get_new_iterator" into "iterator", obviously
> leaving the previous as an obsolete feature.

The choice of feature name "f" for a feature in a
class named "F" seems out of style, to me.

Even if technically it would work, since SmartEiffel knows a
difference between BAUHAUS or REDAELLI and Bauhaus or
Redaelli, respectively.

Unless other language features are used to express specific
properties of the new iterator, the names may reflect these
properties, such as "one-way", or "reverse" etc.

--
Georg Bauhaus +49 208 8821880
Future Apps GmbH Oberhausen
[hidden email] http://www.futureapps.de