On Mon, Feb 13, 2012 at 12:08 PM, John J Barton <johnjbarton@johnjbarton.com
> wrote:
> On Mon, Feb 13, 2012 at 11:44 AM, Ian Hickson <ian@hixie.ch> wrote:
> > On Thu, 17 Nov 2011, Joshua Bell wrote:
> >>
> >> Wouldn't it be lovely if the Worker script could simply make a
> >> synchronous call to fetch data from the Window?
> >
> > It wouldn't be so much a synchronous call, so much as a blocking get.
> >..
> > Anyone object to me adding something like this? Are there any better
> > solutions? Should we just tell authors to get used to the async style?
>
> I guess the "Q" folks would say that remote promises provides another
> solution. If promises are adopted by the platform, then the async
> style gets much easier to work with.
> https://github.com/kriskowal/q
> (spec is somewhere on the es wiki)
>
<http://wiki.ecmascript.org/doku.php?id=strawman:concurrency>
This spec doesn't quite correspond to Kris' implementation. We're still
working that out. John's "then" below corresponds to "when" on the wiki
page.
>
> In the Q model you would fetch data like:
> parentWindow.fetchData('myQueryString').then( // block until reply.
> function(data) {...},
> function(err) {...}
> );
> Q has functions to join promises; q_comm add remote promises.
>
> I believe this can be done today with q_comm in workers.
>
> Your signal/yieldUntil looks like what es-discuss calls "generators".
> I found them much harder to understand than promises, but then I come
> from JS not python.
>
> jjb
>
>
--
Cheers,
--MarkM