Introduction, comprehensions beyond arrays

Brendan Eich brendan at
Fri May 10 12:52:26 PDT 2013

Brendan Eich wrote:
> Mike Stay wrote:
>> On Fri, May 10, 2013 at 1:07 PM, Brendan Eich<brendan at>  
>> wrote:
>>> What's wrong with the iteration protocol?
>> Nothing at all for arrays.  For every other monad, there's no sugar:
>> the only monad multiplication that's supported is list concatenation.
> Iteration is much more general than "arrays".

Oh, sorry -- you mean comprehensions (not the iteration protocol, which 
is used by all for-of syntax) are only about creating fresh arrays.

Yes, that's true. One alternative is a generator expression, which 
doesn't build any eager data structure, rather iterates and yields 
values on demand.

As Jason pointed out, arrows sweeten the explicit monadic patterns, e.g. 
monadic Promises. To close this thread it would be helpful to see an 
example where you use all the ES6 sugar, and then say why you'd still 
want another special form.


More information about the es-discuss mailing list