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

Sandro Magi smagi at naasking.homeip.net
Tue Apr 4 09:02:10 EDT 2006


Paul Sowden wrote:
> 
> On 3 Apr 2006, at 21:38, Sandro Magi wrote:
> 
>> That's 52-3=49 lines of less code. If you still want getValueList()
>> and getKeyList():
> 
> Sorry, I call bullshit.  This is a completely bogus metric.  Coercing
> objects into an Array just to iterate over them again doubles the
> complexity.

Please see:

http://trac.dojotoolkit.org/browser/trunk/src/collections/Dictionary.js
http://trac.dojotoolkit.org/browser/trunk/src/collections/ArrayList.js

The internal data is already in array form, so the added complexity or
runtime overhead is nil. The intent is that the forEach implementation
is specific to the collection. ArrayList and Dictionary just happen to
share the same implementation.

Sandro




More information about the dojo-contributors mailing list