Re: Synchronous postMessage for Workers?

Le 14/02/2012 14:31, Arthur Barstow a écrit :
> On 2/14/12 2:02 AM, ext David Bruant wrote:
>> Le 13/02/2012 20:44, Ian Hickson a écrit :
>>> Should we just tell authors to get used to the async style?
>> I think we should. More constructs are coming in ECMAScript. Things
>> related to language concurrency should probably be left to the core
>> language unless there is an extreme need (which there isn't as far as I
>> know).
>
> David - if you have some recommended reading(s) re concurrency
> constructs that are relevant to this discussion and are coming to
> ECMAScript, please let me know.
* http://wiki.ecmascript.org/doku.php?id=harmony:generators (with yield)
Yield has been for quite some time in SpiderMonkey. i'm not sure the
syntax in the spec (especially the "function*" functions) is
implemented, but there is a form of it anyway
Unless 2012 ends because of some Mayan calendar issues, generators will
be part of ECMAScript 6.
** Task.js by Dave Herman which uses generators. Built on top of
SpiderMonkey generators (so not the upcoming standard), but really worth
having a look at.
http://taskjs.org/
Related blog post:
http://blog.mozilla.com/dherman/2011/03/11/who-says-javascript-io-has-to-be-ugly/


* Concurrency: http://wiki.ecmascript.org/doku.php?id=strawman:concurrency
Probably one of the most ambitious and promising work. Did not cut it to
ECMAScript 6, but I'm hopeful will be part of ES7.
In a nutshell, this brings the event loop in ECMAScript itself. Even in
ES6, ECMAScript will have no concurrency mechanism whatsoever.
Concurrency is currently defined in HTML5 (event loop, setTimeout, etc.).
Another addition will be promises.
An already working example of promises can be found at
https://github.com/kriskowal/q
** This proposal is championned by Mark S. Miller (added in copy).
The strawman on concurrency seems largely inspired by what is done in
the E programming language. I highly recommend reading the Part III of
Mark's thesis on the topic: http://erights.org/talks/thesis/markm-thesis.pdf

> (I tend to agree if there isn't some real urgency here, we should be
> careful [with our specs]).
I've been participating on es-discuss for more than a year now and
following progress in implementations and things are moving. They are
moving in the right direction (browser vendors cooperate). Maybe slowly,
but they are moving.

I really think all topics that are low level (like concurrency) should
be left to ECMAScript now or addressed first on es-discuss before
thinking of a DOM/WebApp API. Low level things belong to ECMAScript and
any API we think of should be a library built on top of that. That's the
way I see it at least and I'd be happy to discuss if some disagree.

David

Received on Tuesday, 14 February 2012 19:14:48 UTC