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

Tom Trenka ttrenka at gmail.com
Mon Apr 3 03:55:11 EDT 2006

> Are there any technical/efficiency reasons against using functional style
> iteration?
> Tom, I get the feeling you are trying to avoid 'scope creep'! You have
> unfortunately chosen a fundamental topic to work on, implementation
> compromises are difficult, opinions are strong, and everybody has an
> opinion! I presumed you were implementing a generic iterator, yet you talk
> about a specific need. Tom, can you give us a better idea of the scope you
> want to keep within?

Technical or efficiency reasons?  No, not at all.  But the Collections code
is modeled on imperative-styles based on languages that do not have the
strength or the flexibility of JS/LISP/Scheme et al, and I'm saying that I'm
looking to keep it that way.

Bill, functional iterators are just fine, but my fear here is that no one
(outside of a native JS/LISP kind of implementor) will understand how to use
them quickly and well; and I have no desire to try to model a brand new set
of collection-type structures for a large audience to relearn.  One of the
great strengths of JS is that I can model things with relative ease,
regardless of the source or style of the implementation.  I think the
Collections are a great example of this, and the Iterators included
originally there (which were for use within the Collections only) worked
just fine; I don't see anything wrong with using the imperative style.

Morris, my apologies for not being clear but when I was looking for opinions
re: iterators, I was referring only to the Collections and not to a generic
iterator (which is why I keep pointing everyone back at dojo.lang.forEach,
etc.)  I'm not going to duplicate any efforts and I'm not going to design a
brand new style of iterator for the sake of doing it.  Anyone who's coded in
most of the older, more common languages will (and did) recognize the style
of iterator in the Collections, and that was one of the big goals--to
provide a mechanism that is very easy to pick up, with a little bit more
power than a straight-up sparse array.

As far as scope creep goes, my own personal feeling (backed up by opinions
offered by others I respect very much that lurk but don't contribute for a
variety of reasons) is that Dojo (and the various dependencies within Dojo)
is getting to be a little bit bloated, and because of that I am not going to
duplicate functionality that's already provided by a fundamental part of the
system, nor am I going to create something that is difficult for the average
developer to wrap thier brain around (at least, not if I want someone to use
it).  Imperative-style iterators are very easy to understand, regardless of
the efficiency factor.  Functional iterators, not so much.  My original goal
with the Colllections code (almost all of which came directly from f(m)) was
to provide something someone can drop into thier code and use right away.

So...while I enjoy the discussion we're having (and I am, don't get me
wrong), I don't think functional iterators are going to be a part of the
Collections at this point; all I was looking for was a discussion and/or a
stated preference for the style of imperative iterators that tend to be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060403/cda2b112/attachment.htm 

More information about the dojo-contributors mailing list