[dojo-contributors] [feedback wanted] Preferred Iterationforms
Scott J. Miles
sjmiles at turbophp.com
Wed Apr 12 17:13:12 EDT 2006
For the record Tom, whatever you decide on goes as far as I'm concerned.
That is, I can be ignored without offense. :)
>> it was the separation of [current/next] that caused the headaches in the
Ok, I see that Java uses 'next' by convention to mean 'get the next object'
which is logical. .NET iterators work as I described (except they don't have
an atEnd( ) function, afaik).
Scott J. Miles
From: dojo-contributors-bounces at dojotoolkit.org
[mailto:dojo-contributors-bounces at dojotoolkit.org] On Behalf Of Tom Trenka
Sent: Wednesday, April 12, 2006 1:44 PM
To: dojo dev.
Subject: Re: [dojo-contributors] [feedback wanted] Preferred Iterationforms
I had combined your next and current, and in all honesty I'd prefer to keep
it that way; it was the separation of the two that caused the headaches in
the first place (the originals used moveNext(), which returned the value of
atEnd, and apparently that caused some misunderstandings about how the
iterators worked which leads us to where we are today).
Under my suggestion here, current() would return you the current item *and*
advance the internal cursor. I would provide an "item" property only if
someone, for some reason, needed to gain another reference to the current
item in the collection. But I would expect the dev to be using current()
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
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
More information about the dojo-contributors