[dojo-contributors] [feedback wanted] Preferred Iterationforms

Scott J. Miles sjmiles at turbophp.com
Wed Apr 12 16:15:26 EDT 2006

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()) { 
or any of various other constructions
Scott J. Miles
TurboAjax Group
HYPERLINK "http://www.turboajax.com"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)

   var ret=internal[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 <HYPERLINK
"mailto:jon.sykes at media-hive.com"jon.sykes at media-hive.com> wrote: 

        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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060412/98fcf315/attachment.htm 

More information about the dojo-contributors mailing list