A reprieve for ES6 comprehensions

Andy Wingo wingo at igalia.com
Fri Jun 6 06:02:37 PDT 2014


Hi,

A final point while I am thinking about it:

On Fri 06 Jun 2014 13:57, Andy Wingo <wingo at igalia.com> writes:

> 1: Essential differences
> ==
>
> Array comprehensions are eager.  Generator comprehensions are lazy.

This difference shows up here, for example:

  Q.async(function*(){
    return [for (x of y) yield x]
  })()

You can yield in the body of an ES6 array comprehension, but not in the
body of a generator comprehension.  This isn't something you can do with
an internal iterator design.

Andy


More information about the es-discuss mailing list