Introduction, comprehensions beyond arrays

Jason Orendorff jason.orendorff at gmail.com
Fri May 10 08:48:46 PDT 2013


On Thu, May 9, 2013 at 11:42 PM, Mike Stay <metaweta at gmail.com> wrote:

> In Scala, this is desugared into
>   expr1.flatMap(x =>
>     expr2(x).flatMap(y => ...
>       exprN(x, y, ...).map(z =>
>         result(x, y, ..., z)
>       )
>     )
>   )
>

Currently comprehensions use the same protocol as for-of statements, namely
iterators. I think we definitely want them to use the same protocol.

.map() is appealing, but to work with for-of statements, it would have to
support break, continue, and early return, either using exceptions (like
Scala's Breaks) or something new. Part of the appeal of the iterator
protocol is that it doesn't complicate break/continue/return.

Separately, for the list: are arrow-functions lexically transparent to
super and arguments? I hope so! For this kind of desugaring, if nothing
else.

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130510/c3113ab2/attachment.html>


More information about the es-discuss mailing list