[dojo-contributors] [feedback wanted] Preferred Iterationforms

Jesse Kuhnert jkuhnert at gmail.com
Wed Apr 12 16:26:35 EDT 2006


I feel a little bad for being so voicy before.. Just wanted to say that it's
not bad when "java" words and JS words do mix when they make sense, ie no
one should have an aversion to them as long as they clearly define what the
function is doing :)

It seems like current() / next() all make sense right? ...

On 4/12/06, Scott J. Miles <sjmiles at turbophp.com> wrote:
>
> Seems like we went down this road already, but because I can't keep my
> mouth shut, I still say this is my personal preference:
>
> it.atEnd( ) -> boolean EOI indicator
> it.next( ) -> advance position, return value of it.atEnd()
> it.current( ) -> return current item
>
> Then you can be compact like so:
>
> while (it.next()) {
>   ...
> }
>
> Or if you prefer
>
>  while (!it.atEnd()) {
>  ...
>  it.next();
> }
>
> or any of various other constructions
>
> 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 12:36 PM
> *To:* dojo dev.
> *Subject:* Re: [dojo-contributors] [feedback wanted] Preferred
> Iterationforms
>
> 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
> >
>
> --
> 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
>
>
>


--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.  http://opennotion.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060412/67d08250/attachment.htm 


More information about the dojo-contributors mailing list