On 19:16, Mon 21 Dec 09, Carl Worth wrote:
> On Mon, 21 Dec 2009 17:23:55 -0800, Carl Worth <cworth at cworth.org> wrote:
> >   New function              Corresponds to existing function (if any)
> >   ------------              -----------------------------------------
> >   move_to_first             <implicit in iterator creation>
> >   has_next          has_more
> >   move_to_next              advance
> > 
> >   move_to_last              <none>
> >   has_previous              <none>
> >   move_to_previous  <none>
> > 
> >   get                       get
> > 
> > The semantics of those all seem clear enough to me. They provide what's
> > necessary for all three portions of a for loop, (in either direction),
> 
> Except that they don't. :-P
> 
> We don't want has_next and has_previous but something more like "has
> current", (perhaps to pair with get_current?).

Not sure if I understand that. Let's see if I understand well. move_to_first
(or move_to_last) will put the iterator in the first (or last) valid item.
move_to_next (and move_to_previous) will be able to reach an invalid item
outside the list. Is it like that?

In some implementations of iterators (like C++ STD) you can reach invalid items
only in one side of the list, at the end, but not at the beginning. Some people
get use to this idea, but should not be a big deal to do it different.

So you are thinking in a function has_current showing if the current item is
valid. Am I right?

> > The only downside is that the function names are a bit long in some
> > cases, but I'm willing to live with that until someone comes up with
> > better.
> 
> One option is to just drop the "move_ " prefix.

I think that's a good option. The names of the functions are still clear like
that, and the original names are too long.


PS: Sorry for the late reply, Christmas is a busy time.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
                               el odio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100105/aa73e209/attachment.pgp>

Reply via email to