[dojo-contributors] [feedback wanted] Preferred Iterationforms

Tom Trenka ttrenka at gmail.com
Wed Apr 12 15:35:30 EDT 2006


item in that example does, in fact, represents current item and not the next
item.  Brief example on the function (non functional, pseudo code)

iterator.current=function(){
   var ret=internal[currentPosition];
   currentPosition++;
  return ret;
}

so the return from that function should be the current item and not the next
item, which is why I was calling it current().

I'm fine with next, but that's the way it will end up working (i think).

On 4/12/06, Jon Sykes <jon.sykes at media-hive.com> wrote:
>
> while(!it.atEnd()){
>         var item=it.current();
>         do stuff
> }
>
> If var item in this example represents the current item not the next
> I think calling it next will be mad crazy confusing.
>
> If it's not, and it is the next item, it makes sense.
>
>
> Jon Sykes
>
>
> On Apr 12, 2006, at 3:26 PM, Scott J. Miles wrote:
>
> > Yes, I had the same reaction as James.
> >
> > Regards,
> > Scott J. Miles
> > TurboAjax Group
> > http://www.turboajax.com
> > ________________________________
> >
> > From: dojo-contributors-bounces at dojotoolkit.org
> > [mailto:dojo-contributors-bounces at dojotoolkit.org] On Behalf Of Tom
> > Trenka
> > Sent: Wednesday, April 12, 2006 11:43 AM
> > To: dojo dev.
> > Subject: Re: Fwd: [dojo-contributors] [feedback wanted] Preferred
> > Iterationforms
> >
> > No, that's why I sent out the email first before trying to code
> > it.  Anyone
> > else prefer next() over current()?
> >
> > On 4/12/06, James Burke < jburke at dojotoolkit.org
> > <mailto:jburke at dojotoolkit.org> > wrote:
> >
> >       On 4/12/06, Tom Trenka < ttrenka at gmail.com
> > <mailto:ttrenka at gmail.com> > wrote:
> >       [snip]
> >       > var it=col.getIterator();
> >       >
> >       > while(!it.atEnd()){
> >       >     var item=it.current();
> >       >     // do stuff
> >       >  }
> >       >
> >       > The idea here is that current() not only returns the current
> item,
> > but also
> >       > advances the internal cursor to the next item in the collection.
> > atEnd()
> >       > should be obvious. I will also provide an "item" property, which
> > will be the
> >       > current item in the collection. Hopefully this is the best
> > comprimise I can
> >       > think of.  It should also be able to support a for form...
> >       >
> >       > for(it.current();!it.atEnd(); it.current()){
> >       >    // do stuff.
> >       > }
> >       >
> >
> >       if current() does a next operation underneath, I would then prefer
> >       calling the method next(). To me current implies I can call it
> many
> >       times and get the same value (no cursor movement). But that may be
> > my
> >       java experience coloring my perception. Please disregard if this
> > falls
> >       into the holy war section.
> >
> >       James
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.385 / Virus Database: 268.4.1/310 - Release Date:
> > 4/12/2006
> >
> >
> > _______________________________________________
> > dojo-contributors mailing list
> > dojo-contributors at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> >
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060412/978817f4/attachment.htm 


More information about the dojo-contributors mailing list