Open staycoolcall911 opened 1 year ago
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!
The following section should be added to the language reference:
Contrary to JavaScript, any call to an async function is implicitly awaited in Wing. As a result,
await
in Wing is a rarely used keyword, since its use is implied by theinflight
keyword.await
is only used when you want adefer
edPromise
to be fulfilled before execution flow continues. The Wing compiler emitsawait
s when encounteringPromise<T>
types as r-values in expressions. Use thedefer
keyword to defer the resolution of a promise and obtain aPromise<T>
type instead (a.k.a unawait
what the compiler does)."defer" prevents the compiler from awaiting a promise and grabs a reference.
"await" and "Promise" are semantically similar to JavaScript's promises.
"await" statement is only valid in
inflight
function declarations.Awaiting non promises in Wing is a no-op just like in JavaScript.