While I really like comprehensions, as soon as you need a conditional, or any level of nesting, you pretty much have to break it out into a loop to keep it readable.<p>OTOH, block syntax (I don't think that's the correct term for it) has always irked me in JS, due to verbose function declaration, and no implicit return. So beautiful syntax in ruby like:<p><pre><code> some_array.map { |el| el.length }
# Or the succinct version:
some_array.map(&:length)
</code></pre>
Looks like this in JS:<p><pre><code> someArray.map(function() { return this.length; });
</code></pre>
Now that ES6 has arrow functions with implicit returns, we can do this:<p><pre><code> someArray.map( s => s.length );
</code></pre>
Since both comprehensions and implicit return functions are being released around the same time, I'll be interested to see which of the two gets more adoption.
Nice to see generator comprehensions in js. Glad that I don't have to remember anything much when coming from Python due to the choice of '('.<p>Does anyone know where the for..of syntax comes from? Just seems to deviate from the way that other languages represent comprehensions (including maths).
This is bizarre to me. Why complicate the browser with a feature that amounts to syntactic sugar?<p>Why not keep JS simple (or better yet, simplify it further!) so that browser implementations might finally converge, and leave the syntactic niceties to preprocessors & compilers?