Open eladb opened 1 year ago
Should promise
be the name of some global object, or should it require bring promise;
?
(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 Promise.xxx()
(same as we have Array
and Set
..,
Updated the description to use capital letter
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. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
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. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
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 thepromise
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