A reprieve for ES6 comprehensions

C. Scott Ananian ecmascript at cscott.net
Fri Jun 6 07:25:25 PDT 2014

On Fri, Jun 6, 2014 at 7:57 AM, Andy Wingo <wingo at igalia.com> wrote:
> Comprehensions match ES6 very well as it is, without considering the
> possible addition of parallelism.  They even match up well if we add the
> other dimension of asynchronous comprehensions -- i.e. [for x of await y
> z], (for x of await y z).  I don't think it's unreasonable to expect PJS
> to also extend the syntax in this way -- we end up with 2³ squares in
> our "matrix" -- eager vs lazy, sync vs async, parallel vs not -- and
> that seems fine to me.

Not that another alternative is transactional parallelism, where await
ends up marking atomicity boundaries.  Separate iterations of [for x
of await y z] can execute in parallel, protected by a transaction
mechanism (STM/HTM/hybrid/etc) to ensure that the semantics match a
serial execution.  This is in many ways a better match for
JavaScript's existing concurrency model -- which programmers seem to
prefer over an explicit locks+threads model.

So, for one, I wouldn't want to put the PJS cart before the JS horse.

More information about the es-discuss mailing list