This looks very useful, as it's already useful in other languages.
I found the syntax a bit confusing though. `await` comes before a promise, except in this case. I wonder what the reasoning behind the syntax was.
I found the syntax a bit confusing though. `await` comes before a promise, except in this case. I wonder what the reasoning behind the syntax was.
For what it’s worth, I always thought this syntax for await felt more natural:
let await user = getUser()
But now we have it both ways for different use cases and it’s weird.Keep in mind, await may need to be in both sides:
await using connection = await getConnection()
If it was `using await` that might give some confusion if it was awaiting the left or right side or the future disposal.Similarly, it gets fun combined with AsyncIterable:
for await (await using connection of getAllConnections()) { }