Fwd: [dojo-contributors] [feedback wanted] Preferred Iteration forms

Tom Trenka ttrenka at gmail.com
Tue Apr 4 10:04:06 EDT 2006


That's the way I'm leaning; I may use item() instead of current.

trt

On 4/4/06, Sandro Magi <smagi at naasking.homeip.net> wrote:
>
> Tom Trenka wrote:
> > The ideal would be to not use it at all, which is basically what I've
> > arguing with you guys about.  I've no problem creating the dependency
> > with the search trees and graph; both of the those are much more complex
> > than the other collections.
> >
> > Jeez, all I wanted to know was which style of imperative iterator we
> > preferred.
>
> Minimal seems best:
>
> var it = obj.getIterator();
> while(it.next()) {
>   var cur = it.current; //or it.value, or ...
>   //...
> }
>
> Smallest, simplest interface (1 method + 1 property), less likely to get
> the iteration pattern wrong. I recommend the same interface be used for
> the Dictionary too; just return A DictionaryEntry or a 2-element array
> so the iteration looks the same.
>
> Sandro
> _______________________________________________
> 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/20060404/5ffd59cf/attachment.htm 


More information about the dojo-contributors mailing list