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

Bill Keese bill at dojotoolkit.org
Tue Apr 4 08:37:56 EDT 2006


OK, well go ahead and fix the imperative iterators, like you set out to 
do in the first place.

But since there are a number of people that seem to want the functional 
iteration, don't be too surprised if someone adds that into the 
collections code (at some point in the future).

Bill

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.
> 
> On 4/3/06, *Bill Keese* < bill at dojotoolkit.org 
> <mailto:bill at dojotoolkit.org>> wrote:
> 
>     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
>     <mailto:dojo-contributors at dojotoolkit.org>
>      > http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>     _______________________________________________
>     dojo-contributors mailing list
>     dojo-contributors at dojotoolkit.org
>     <mailto:dojo-contributors at dojotoolkit.org>
>     http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

-- 

Bill



More information about the dojo-contributors mailing list