-
Notifications
You must be signed in to change notification settings - Fork 204
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
Function Types: Promise #1004
Comments
Should (I'm guessing we should minimize global namespace pollution in our language if possible) |
I agree that we should minimize, but think promise should be there |
We should consider various syntax options. I actually think the JS syntax is pretty solid, so it could be just |
Updated the description to use capital letter |
Promise.xxx
use cases
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Feature Spec
https://github.com/winglang/wing/blob/main/docs/04-reference/winglang-spec.md?rgh-link-date=2022-11-10T13%3A18%3A56Z#362-promises
Support for
Promise.xxx
use cases.It is now possible to implement advanced concurrency flows using the
promise
API:These statements behave like their JavaScript
Promise.xxx
counterparts.Promise.all(p1, p2, ...)
Promise.any(p1, p2, ...)
Promise.all_settled(p1, p2, ...)
Promise.race(p1, p2, ...)
The result is a promise that needs to be explicitly
await
ed.For example, let's say I want to wait for two async operations to succeed before continuing the flow:
In this suggestion, the Promise type is similar to other built-in types like
Set
,Map
, ...Use Cases
Advanced concurrency
Implementation Notes
No response
Component
Compiler
The text was updated successfully, but these errors were encountered: