>  Still, my point stands: you are not using task.js-like
scheduler/combinator approach for an apples-to-apples comparison with
await. If you do, then we're down to the obligation of a task.js download,
and some syntactic sugar.

see comments in gist, adding a library also has some stuff with source maps
that I am not too keen on in particular. I can use libraries to simplify
many things / manage code, but doing similar tasks without using a library
seems more in line w/ my original question (which has been answered).
Either way, for now it seems like generator-iterators won't have references
to themselves and I can just wrap it.

Allan: an interesting idea that does simplify things, updating gist. Still
using a wrapper since even w/ new the generator returns a generator
instance (otherwise I could use instanceof checks).

Note: cleaned up gist somewhat in general / simplified


On Thu, Jan 23, 2014 at 6:43 PM, Brendan Eich <bren...@mozilla.com> wrote:

> Bradley Meck wrote:
>
>> Is that true even though then should fire after the generator unwinds its
>> stack?
>>
>
> True if .then always runs in a later turn -- sorry.
>
> Still, my point stands: you are not using task.js-like
> scheduler/combinator approach for an apples-to-apples comparison with
> await. If you do, then we're down to the obligation of a task.js download,
> and some syntactic sugar.
>
> // assume req in scope
> spawn(function*()  {
>   try  {
>     var  session  =  yieldlogin(req);  // wait until the promise resolves
>     gotoProfile(session);
>   }
>   catch  (e)  {
>     printError(e);
>     gotoLogin();
>   }
>   // implicit return undefined
> });
>
> BTW, in ES7, no "use await"; will be needed ;-).
>
> If you want to control when the task starts, you'd use new Task. If you
> want to send req, you'd control starting via t = new Task(function*(){...})
> and call t.next(req). Hope this is all clear from http://taskjs.org/ and
> the code.
>
>
>  I am using regenerator right now while playing with this stuff.
>>
>
> Cool -- can you try task.js?
>
> /be
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to