Tom Van Cutsem
tomvc.be at gmail.com
Wed Jul 4 10:45:10 PDT 2012
This idea has been explored before. Some relevant pointers:
Kris Kowal's Q API with experimental support for using generators to write
synchronous-style yet asynchronously-executing functions:
Strawman for standardization of the above idea:
Task.js: cooperative multithreading via generators:
2012/7/4 Patrik Stutz <patrik.stutz at gmail.com>
> Hi guys!
> It's called 'delay'.
> What does the delay keyword ?
> The delay keyword does nothing more than stop the execution of the
> current stack and immediately continues to the next task in the queue. But
> that's not all! Instead of discarding the stack, it adds it to the end of
> the queue. After all tasks before it are done, the stack continues to
> What is it good for?
> delay could help make blocking code non-blocking while it still looks
> like synchronous code. A short example:
> delay; //since there is currently another task in the queue, do this task first before continuing
> //Outputs: one, two, three
> This simple keyword would allow us to create a synchronous-looking code
> wich is asynchronous behind the scenes. Using node.js modules, for example,
> would no longer be impossible to use in the browser without trickery.
> There would be so many possibilites with such a keyword!
> do to bring this into the new ECMAscript Specification?
> Please disuss as much as you want! :)
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss