(no title)
jkoudys | 2 years ago
const foo = async function() {
const user = await fetchUser()
But if they'd just made a Promise.coroutine, you could equivalently do this without needing to change the language: const foo = co(function* () {
const user = yield fetchUser()
There's some unpopular cases like async iterables or async generators, but for the most part we could've done the same thing without extending the language. I remember the v1 of koa that had yield everywhere and people thought it was confusing af. Then they released with await and suddenly it made sense to people.
athanagor2|2 years ago
wruza|2 years ago