-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: implement async / await #5
Comments
Just as a reference point for any others interested in async/await, experimental async/await support is available in traceur. See https://github.com/google/traceur-compiler/wiki/LanguageFeatures#async-functions-experimental It works well in my experience, and having it in TypeScript would make it a joy to use, in node especially. 😄 I put up a simple repo that shows using async/await with traceur and node at https://github.com/jamesmanning/node-traceur-asyncawait |
👍 👍 👍 |
👍 |
There was a lengthy discussion about this back in 2012 prominent also on the CodePlex site. One of the problems described there (by Mads Torgersen amongst others) was the lack of something to build it on top of. Like the Task abstraction in the .NET Framework. Promises to me looks awfully a lot like that and what the TypeScript compiler will have to support is the rewiring of the program flow to use promises (specifically there seems to be a spec called Promises/A+ (http://promisesaplus.com/) that is exactly this glue). I also find that there's a lesson here to be learned from the .NET Framework. For example, the AggregateException. Such a mechanism can be implemented in library alone and TypeScript does not have to offer a companion library for a feature which is largely source work. What I'm trying to get at is that the way that async/await changes how you write code for the better. I'd rather see a TypeScript implementation of async/await on top of promises today (that will at least run in Chrome) than wait another two or three years for ES7 async to be wide spread. |
👍 |
A more detailed proposal available in #1664. |
New TextStreamWriter interface with JSDoc and additional members
Implement TypeScript support for the proposed ES7 functionality for async functions
See http://wiki.ecmascript.org/doku.php?id=strawman:async_functions
The text was updated successfully, but these errors were encountered: