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

Bill Keese bill at dojotoolkit.org
Mon Apr 3 20:23:39 EDT 2006

You and I are both concerned with the size of dojo's footprint.  But, 
common libraries like dojo.lang exist to prevent code duplication and 
thus to decrease the size of the footprint.

If you duplicate the code in dojo.lang, most people will end up pulling 
in both dojo.lang and your duplicated code.  I know you want to avoid 
pulling in array.js, but I really don't think that will ever be possible 
with dojo, at least not for most applications.

Also, if you duplicate the forEach() function, then you duplicate 
possible bugs in that function.

Tom Trenka wrote:
>     I think the issue is non-array based collections, such as graphs and
>     trees.  Coercing those objects into arrays (copying all of the data) is
>     inefficient.  Both calling dojo.lang.forEach() and imperative iterators
>     require copying all the data to an array.  Thus writing your own
>     forEach() is better.  (On the other hand, performance can always be done
>     later... but it's good to decide the API early)
> That's fine.  I have no problem with a custom iterator on those types of 
> complex collections; that makes plenty of sense.  I just don't want to 
> throw out what is probably the most common type of iterator for the sake 
> of doing a functional one, and I don't want to force a dependency if I 
> don't have to.
>     It's hard to believe that many people are using dojo without including
>     lang/array.js.  forEach() is referenced 38 times in the code, even from
>     event.js.
> That's no reason to assume it's presence; that kind of thinking (no 
> offense) is the reason why the Animation code has 13 or so dependencies now.
> ------------------------------------------------------------------------
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

More information about the dojo-contributors mailing list