logoalt Hacker News

tracker1yesterday at 4:07 PM1 replyview on HN

Contrast it with async in JS/ES as an example... now combine it with the using statement for disposeAsync instances.

    await using db = await sqlite.connect(await ctx.getConfig("DB_CONN"));
It's not so bad when you have one `await foo` vs `foo.await`, it's when you have several of them on a line in different scopes/contexts.

Another one I've seen a lot is...

    const v = await (await fetch(...)).json();
    
Though that could also be...

    const v = await fetch(...).then(r => r.json());
In any case, it still gets ugly very quickly.

Replies

adastra22yesterday at 5:09 PM

I’ve never in my life used JS, so I’ll have to take your word for it.

show 1 reply